Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Tutorials and Tips (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=27)
-   -   Easy way to put user's avatar on any page (http://www.mysidiaadoptables.com/forum/showthread.php?t=3803)

Derpstra 08-20-2012 04:05 PM

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! :smile:


All times are GMT -5. The time now is 03:13 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.