MyBB Community Forums

Full Version: Need a script to grab a user's avatar for use in MyCode...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
I'll test it out when I mess w/ my forum again in a few days. I'll letcha know how it works. Smile
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...
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%">';
Thanks. Smile