By Marcus Palmer on Sunday, 15 February 2015
Posted in General Issues
Replies 8
Likes 0
Views 855
Votes 0
I'm trying to echo user friends list is this possible is this possible?
Hello Marcus,

I am sorry for the delay of this reply.

Yes you will getting array with that code but you need to perform 'foreach' operation to single fetch the array value.
Refer the following code to fetch the list of friends by name.

$my = JFactory::getUser(); // load current logged in user
$model = FD::model('friends');
$listOfFriends = $model->getFriends($my->id);
foreach ($listOfFriends as $friend) {
echo $friend->name; // display the friend list with their name only
}


Hope these help
·
Monday, 16 February 2015 16:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

Yes, it is possible. You can use this:

$model = FD::model('friends');
$listOfFriends = $model->getFriends('54'); // 54 is the user id.


Hope this helps.
·
Sunday, 15 February 2015 10:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the reply

I need this not for specific User but for user logged in!
And how are you echo-ing this

Thanks for the help
·
Monday, 16 February 2015 02:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

Ah, I see. You can first load the logged in user:

$my = JFactory::getUser(); // load current logged in user
$model = FD::model('friends');
$listOfFriends = $model->getFriends($my->id);

echo $listOfFriends;


·
Monday, 16 February 2015 10:15
·
0 Likes
·
0 Votes
·
0 Comments
·
I'm getting "Array" with that code??
·
Monday, 16 February 2015 13:02
·
0 Likes
·
0 Votes
·
0 Comments
·
@Ezrul Fazwan Cheers bro that did it;)

Really appreciated "excellent support as usual"

Quick question: You know the status circle that pops up on the friends list next users profile to show online/offline users, can i echo this out?
·
Monday, 16 February 2015 19:56
·
0 Likes
·
0 Votes
·
0 Comments
·
it's ok i figured it out with a IF statement;)
·
Monday, 16 February 2015 21:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

Glad you figured it out.
·
Tuesday, 17 February 2015 01:04
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post