By Edgar on Saturday, 06 August 2016
Posted in General Issues
Replies 3
Likes 0
Views 286
Votes 0
Hello,
I have a module which show contents depending of the id user. What I want is the content depend not on the id of the user connected but on the id of the user of which the profile is viewed.

How can I retrieve the id of the user of which the profile is viewed ?

Thanks for your help,

EG
Hey there,

I am really sorry for the delay of this reply as it is a weekend for us here.

Do you mean your module from the user profile page?

If yes, you can try following code and see how it goes.

$id = JRequest::getInt( 'id' , null );
$my = ES::user($id); // current user profile id
·
Sunday, 07 August 2016 15:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Thanks for your legendary reactivity

It works, I can display the name of the user viewed in my custom module (with echo $my->getName(); )
Just one last question : if I want to display the Id, how can I do ? I tried $my->getId but it doesn't work.

Thanks for your great help,

EG
·
Sunday, 07 August 2016 16:42
·
0 Likes
·
0 Votes
·
0 Comments
·
When the code wrote this :

ES::user($id);


It actually go to this user library -> JooomlaFolder\administrator\components\com_easysocial\includes\user\user.php , the reason why getId() function didn't work is because our user library do not have this getId() function, you can just write following code then you can get the user id.

echo $my->id;
·
Monday, 08 August 2016 11:28
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post