By Marcus Palmer on Tuesday, 17 February 2015
Posted in General Issues
Replies 16
Likes 0
Views 873
Votes 0
Ok lads so this

$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
}


Gives me the name of my friends list but how would you

1. link the Name back to friends profile and
2. show friends avatar also within the a href

is this possible?
Hello Marcus,

Here is the correct code to display the link based on your current code:

echo "<a href=\"".$friend->getPermalink()."\" class=\"uk-button uk-width-1-1 uk-text-left\">".$friend->name."
<i class=\"uk-icon uk-icon-circle uk-text-success\">
</i></a><br>";


However, I just can provide you the code because I'm not familiar with the module you are using.
·
Thursday, 19 February 2015 11:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

Please use this codes:

$friend->getPermalink() // get the profile link
$friend->getAvatar() // get the user's avatar


Hope this helps.
·
Tuesday, 17 February 2015 01:02
·
0 Likes
·
0 Votes
·
0 Comments
·
how you echoing this? can't get syntax right
·
Tuesday, 17 February 2015 01:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

Maybe you missed the ';' at the end.

echo $friend->getPermalink(); // get the profile link
echo $friend->getAvatar(); // get the user's avatar


Make sure this is in the foreach loop.
·
Tuesday, 17 February 2015 02:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Marcus Palmer wrote:

The code you sent echo's the actual url/paths, I need to wrap this as a link and have avatar before name;)

 foreach ($listOfFriends as $friend) {

if( $friend->isOnline( ) )
{


echo "<a href=\"#\" class=\"class">$friend->name
<i class=\"uk-icon uk-icon-circle uk-text-success\">
</a>".'<br>';
}

}







and lost trying to add image as when i use img tag again getting 500 error
·
Tuesday, 17 February 2015 07:07
·
0 Likes
·
0 Votes
·
0 Comments
·
is this possible???? to wrap the entire echo in a link to profile and have an image before $friend->name ?
·
Tuesday, 17 February 2015 07:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

Can you provide us your backend and FTP access so we can have a better look on your issue here? And can you please verify which file you have modified and which page to view the output. Also, kindly please understand that this is beyond the scope of our support. But I will help you on this one.
·
Tuesday, 17 February 2015 10:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry had a job that required me Onsite

Preparing info shortly
·
Thursday, 19 February 2015 07:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Site details below
·
Thursday, 19 February 2015 09:08
·
0 Likes
·
0 Votes
·
0 Comments
·
I'll implement this and let you know how i get on...

Bro just like to say thanks for the help and support true CLASS!
·
Thursday, 19 February 2015 22:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

You're welcome and thanks for the compliment. Really appreciate that.
·
Thursday, 19 February 2015 23:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Amazing that worked a treat but how do i get the friends image/Avatar in that link?
·
Thursday, 19 February 2015 23:53
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

You can get the avatar link using this:

$friend->getAvatar();


·
Friday, 20 February 2015 00:14
·
0 Likes
·
0 Votes
·
0 Comments
·
I did that, but it echo-ed the url so i tried this

<img src=<?php echo $friend>getAvatar(SOCIAL_AVATAR_MEDIUM);?> />


But i think the php? echo is wrong in the image tag when i place between the <a> </a>
·
Friday, 20 February 2015 00:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Do you think this looks right?

echo  "<a href=\"".$friend->getPermalink()."\" class=\"uk-button uk-width-1-1 uk-text-left\"> <img src=\"".$friend->getAvatar(SOCIAL_AVATAR_SMALL)."\">".$friend->name."
<i class=\"uk-icon uk-icon-circle uk-text-success\">
</i></a>
·
Friday, 20 February 2015 00:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Marcus,

The code should look like this,

·
Friday, 20 February 2015 18:14
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post