Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 4 Years, 11 Months, 3 Weeks ago [How To?] [RESOLVED] Create hyperlink in PHP
#1
Solved: 4 Years, 11 Months, 3 Weeks ago
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,
Hey man, what's up?
Reply
#2
Solved: 4 Years, 11 Months, 3 Weeks ago
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
            { 
My Plugins

PM only paid support
Reply
#3
Solved: 4 Years, 11 Months, 3 Weeks ago
(10-24-2014, 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!

(10-24-2014, 06:37 PM)Michael2014 Wrote:
(10-24-2014, 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:[Image: Untitled.png]

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
Hey man, what's up?
Reply
#4
Solved: 4 Years, 11 Months, 3 Weeks ago
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.
Reply
#5
Solved: 4 Years, 11 Months, 3 Weeks ago Photo 
(10-25-2014, 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[Image: default_online.png]

Now, the layout runs vertical, instead of horizonta as seen in example #1 and #2.

example #2
[Image: default2.png]

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
Hey man, what's up?
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)