View Single Post
  #1  
Old 08-20-2012, 04:05 PM
Derpstra's Avatar
Derpstra Derpstra is offline
Seamstress!
 
Join Date: Aug 2012
Location: Seattle, WA/Charlotte, NC
Posts: 26
Gender: Female
Credits: 5,248
Derpstra is on a distinguished road
Default Easy way to put user's avatar on any page

Being a very lazy person, I like to make my scripts as simple as possible. Usually I achieve this by messing around with the functions. Today I made an easy one that allows you to put the user's avatar wherever you want!

First, add this function to the page functions/functions_users.php:
PHP Code:
function usernametoavatar($name){
    
$row $GLOBALS['adopts']->select("users_profile", array("username""avatar"), "username='{$name}'")->fetchObject();
    return 
$row->avatar;

Now, on whatever page you want to add their avatar to, paste this anywhere on the page before $article_title:
PHP Code:
$avatar usernametoavatar($username); 
Then, in your $article_content, place this wherever you want the avatar to show up:
PHP Code:
<img src='{$avatar}' /> 
Ta da! They will see their own avatar!
__________________
-
Reply With Quote