Created
April 5, 2018 11:37
-
-
Save nielsnuebel/e7d96df2332f812ad7fe1c1d06fe6a11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function _getUserData() | |
{ | |
if ($this->user->guest) | |
{ | |
return; | |
} | |
// Get the dispatcher and load the user's plugins. | |
$dispatcher = \JEventDispatcher::getInstance(); | |
PluginHelper::importPlugin('user'); | |
$data = new \JObject; | |
$data->id = $this->user->id; | |
// Trigger the data preparation event. | |
$dispatcher->trigger('onContentPrepareData', array('com_users.profile', &$data)); | |
if (isset($data->profile)) | |
{ | |
$this->user->profile = $data->profile; | |
} | |
$fields = FieldsHelper::getFields('com_users.user', $this->user, true); | |
// Adding the fields to the object | |
$this->user->customfields = new \JObject; | |
foreach ($fields as $key => $field) | |
{ | |
$fieldname = $field->name; | |
$this->user->customfields->$fieldname = $field->value; | |
} | |
$params = new JRegistry; | |
$this->user->params = $params->loadString($this->user->params); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@laoneo i need another structure. I only use this https://github.com/joomla/joomla-cms/blob/staging/plugins/system/fields/fields.php#L479-L487