Need a script to grab a user's avatar for use in MyCode...
#1
I have a Blog section set up in my forum, which outputs on the main section of my website.

I was thinking of having a MyCode (based on their username), which would have them input the URL to their current avatar. But what if the user changes the URL of their avatar?

So, thus, is there anyway to somehow create a MyCode which takes their UID, grabs their avatar code, and outputs it, so even if they change it, the script is finding the "current" avatar, so there isn't the issue of a old URL in the code.
Avatar by Rein.
Reply
#2
This is a polugin which i made time ago for some friends, i hope it could help you.

The MyCode is:
[avgrab]1[/avgrab]

Now i optimized the code. Just replaced preg_match and str_replace with preg_replace_callback.


Attached Files
.php   avgrab.php (Size: 614 bytes / Downloads: 137)
Reply
#3
I'll test it out when I mess w/ my forum again in a few days. I'll letcha know how it works. Smile
Avatar by Rein.
Reply
#4
I need to have the MyCode output this HTML...

<table><tr>
<td valign="top" width="10%"><img src="$1" align="left" hspace="6" vspace="6" /></td>
<td width="90%">

How would the plugin be edited to allow for this? I tried doing it myself, but I kept having issues...
Avatar by Rein.
Reply
#5
It is simple PHP. Smile

Find
return $user['avatar'];
Replace with
return '<table><tr>
<td valign="top" width="10%"><img src="' . $user['avatar'] . '" align="left" hspace="6" vspace="6" /></td>
<td width="90%">';
Reply
#6
Thanks. Smile
Avatar by Rein.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)