Skip to content

Instantly share code, notes, and snippets.

@joomdonation
Created March 22, 2016 14:51
Show Gist options
  • Select an option

  • Save joomdonation/15f94c19aff36816b830 to your computer and use it in GitHub Desktop.

Select an option

Save joomdonation/15f94c19aff36816b830 to your computer and use it in GitHub Desktop.
<?php
function getUserInput($userId)
{
$form = JForm::getInstance('user-field', '<form> </form>');
$element = new SimpleXMLElement('<field />');
$element->addAttribute('type', 'User');
$element->addAttribute('name', 'user_id');
$element->addAttribute('class', 'readonly');
$form->setField($element);
$form->setValue('user_id', null, $userId);
$field = $form->getField('user_id');
echo $field->input;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment