Hi all, How can I create a hyperlink in php and apply it to the following img tag, that links back to the avatar's profile?
if ($us['avatar'] != "")
{
$user_avatar = '<img src="'.$us['avatar'].'" alt="Avatar" title="'.$user['username'].' \'s Avatar" width="35px" height="35px"></a>';
}
else
{
Note: I'm trying to hyperlink the image of the online user's avatar.
I've tried for 4 hours to no avail, any help would be greatly appreciated,
lik to? profile or what?
if ($us['avatar'] != "")
{
$user_avatar = '<a href="/member.php?action=profile&uid='.$us['uid'].'"><img src="'.$us['avatar'].'" alt="Avatar" title="'.$user['username'].' \'s Avatar" width="35px" height="35px"></a>';
}
else
{
(2014-10-24, 06:20 PM)Supryk Wrote: [ -> ]lik to? profile or what?
if ($us['avatar'] != "")
{
$user_avatar = '<a href="/member.php?action=profile&uid='.$us['uid'].'"><img src="'.$us['avatar'].'" alt="Avatar" title="'.$user['username'].' \'s Avatar" width="35px" height="35px"></a>';
}
else
{
Ha ha! Look at that! Works Perfect. Thank you for taking your valuable time to respond, you saved me so much, I was dying just trying to figure it out, and now I can finally go to sleep and rest my burning, aching eyes, after hours of struggle.
Thanks again! +rep!
(2014-10-24, 06:37 PM)Michael2014 Wrote: [ -> ] (2014-10-24, 06:20 PM)Supryk Wrote: [ -> ]lik to? profile or what?
if ($us['avatar'] != "")
{
$user_avatar = '<a href="/member.php?action=profile&uid='.$us['uid'].'"><img src="'.$us['avatar'].'" alt="Avatar" title="'.$user['username'].' \'s Avatar" width="35px" height="35px"></a>';
}
else
{
Ha ha! Look at that! Works Perfect. Thank you for taking your valuable time to respond, you saved me so much, I was dying just trying to figure it out, and now I can finally go to sleep and rest my burning, aching eyes, after hours of struggle.
Thanks again! +rep!
Update:Hi, sorry, it looks like it is not resolved, the following code you provided, although awesome, only links back to the user's profile, even when the click on another online user's profile, what I need it for the person who clicks the avatar of an online user to be taken to the profile of the user they clicked, as in the image attached:
any further help in solving this would be eternally appreciated.
P.S.you still deserve the +rep for being a great help.
Okay, after hours of struggle then a fresh night sleep.I was able to wake up with a new approach but I could not have done it without Supryk,
the solution: change avatar to uid.
These are personal mods so not many people will not encounter these issues.
God Bless
You should really consider using the format_avatar function instead of directly using the database field. This makes sure it is within the dimensions specified. It also provides a default avatar if the user has no avatar.
(2014-10-25, 01:35 PM)dragonexpert Wrote: [ -> ]You should really consider using the format_avatar function instead of directly using the database field. This makes sure it is within the dimensions specified. It also provides a default avatar if the user has no avatar.
Hi Dragon, I so appreciate the expert insight, I added the function as you explained
and set the default on the online page to 82x82, brilliant suggestion!
In general, here is how I modified the layout of the "Who's Online"
example #1
Now, the layout runs vertical, instead of horizonta as seen in example #1 and #2.
example #2
Thank you for all the help you give to us on the forum, myselfI'm really grateful!
P.s the only thing I can't figure out at this moment is how to make the online counters work on the
"who's online" - any pointers my friends?
as it should in the example #2 pic