By Anthony on Friday, 08 January 2021
Posted in General Issues
Likes 0
Views 465
Votes 0
Is there a way to get specific user profile information when I have access to the following information?


$user = ES::user($userid);


If not, could you suggest how I might get the profile information?

At the moment, I am specifically after the user's timezone, but I expect that I will probably want to get other fields later.

Any help is much appreciated.
You can try the following code to receive the user custom field data :


// current user profile id
$userProfileId = '123';

$userData = ES::user($userProfileId);

// find your user workflow custom field unique key e.g. TEXTBOX
$customField = $userData->getFieldValue('TEXTBOX');

echo $customField;exit;
·
Friday, 08 January 2021 16:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for that Arlex

I tried using

<?php $timezoneField = $userData->getFieldValue('JOOMLA_TIMEZONE');?>

but xdebug gave me null for all values. I'm not really sure why. I've attached the image of the results below. At the time, I was using the default timezone, so I changed it from default to Australia/Melbourne but there was no difference.

In the end, I was able to get the timezone using the birthday field

<?php
$birthdayField = $userData->getFieldValue('BIRTHDAY');
$usertimeraw = $birthdayField->raw;
$usertimezone = $usertimeraw['timezone'];
?>
·
Friday, 08 January 2021 20:27
·
0 Likes
·
0 Votes
·
0 Comments
·
It seems like the Joomla timezone field data stored back into Joomla user table.

I think you can try get the timezone like this :



var_dump($userData->params);

So you will get this data :

["params"]=>
string(116) "{"editor":"arkeditor","timezone":"Asia\/Singapore","language":"","admin_style":"","admin_language":"","helpsite":""}"
·
Saturday, 09 January 2021 00:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Excellent. Thanks for that Arlex
·
Monday, 11 January 2021 10:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding.
·
Monday, 11 January 2021 10:06
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post