By Adam O. on Thursday, 08 October 2015
Likes 0
Views 1.1K
Votes 0
Hi there,

I'll ask about loading $user->getProfile()->get('id') in other elements of ES.

It perfectly works in eg. default.header.php, but when I'll load this in eg. themes/wireframe/videos/default.php it show me and error:


Notice: Undefined variable: user in /components/com_easysocial/themes/wireframe/videos/default.php on line 79

Fatal error: Call to a member function getProfile() on a non-object in /components/com_easysocial/themes/wireframe/videos/default.php on line 79


which line of code I need to copy (in controller I suppose) to load actually viewed user Profile Type ID?

I'll be very grateful for your help!

Best regards!
Adam
Hello Adam,

You can try this:

echo $this->my->id; // this will display the id for the current logged in user.


Hope this helps.
·
Thursday, 08 October 2015 10:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Nik,

yes, but I need Profile Type ID of actually viewed user (not my)
·
Friday, 09 October 2015 02:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Adam,

Ah, I see. You can use this instead:

$user = FD::user($uid); // $uid is the user id for the viewed user. This line is to load the user table.
echo $user->getProfile()->id;


Hope this helps.
·
Thursday, 15 October 2015 18:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Nik,

I need to refresh this thread - loading Profile Type ID actually viewed user (not my) in ES 2.0

When I put your last code, it loads Profile Type id but my, not user who I actually see.

How can I modify it to work correct?

Best regards!
Adam
·
Wednesday, 14 December 2016 07:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok, I found mistake in my code, so we can close this thread

regards!
Adam
·
Wednesday, 14 December 2016 09:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Glad to hear that. I'll close this ticket.
·
Wednesday, 14 December 2016 10:13
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post