Created
July 11, 2018 21:26
-
-
Save tonypartridge/b4559053f4af769204785bdb5e7d1ead to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
/** In this scenario I have a custom field, type list with the name 'company-name' for my users **/ | |
$user = JFactory::getUser(); | |
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); // Load the custom fields helper | |
$ProfileFields = FieldsHelper::getFields('com_users.user', $user, true); | |
foreach ($ProfileFields as $field) { | |
if ($field->name === 'company-name') { | |
$companyName = $field->value; | |
$companyId = $field->rawvalue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment