By Chris on Friday, 19 May 2017
Replies 1
Likes 0
Views 828
Votes 0
I've been reading the documentation and was hoping to get some info, hopefully someone can help point me in the right direction.

Basically, I want to pull user info so that when I'm logged into my account, I can see other users data in the postbit associated to their account.

Example:

I'm logged in as John Smith and another user Jane Doe posts on the forum, if Jane Doe has 150 EasySocial Points, I want to see her total EasySocial points display in the postbit instead of mine.

- - - - -

Below is the code I found in the documentation, however, it displays the total points associated to my currently logged in account rather than the other user.


require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php');
$my = ES::user();
$points = $my->getPoints();


What would I have to change in the code above so that other users info will show up in the associated Kunena postbit rather than my own info?

I'm also interested in retrieving custom profile fields as well to display in the postbit.

Thanks and I appreciate any assistance that can be provided

*Edit - Realized this should probably go in the Tutorials category, hopefully that's correct.

*Edit - I found the solution to my problem. I haven't tried retrieving extra fields from users, will try this eventually but if someone has a few pointers in the meantime, that would be great.
[gist]
require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php');
$my = ES::user($userId);
$points = $my->getPoints();
[/gist]

You probably just need to pass in the $userId which is the target user's id
·
Sunday, 21 May 2017 15:28
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post