Home > Onovia, hardware, programming > Display a phpBB3 Avatar on a Custom Page

Display a phpBB3 Avatar on a Custom Page

November 26th, 2007

In your php file, you will need to run a database query, for example:

$sql = 'SELECT user_avatar, user_avatar_type, user_avatar_width, user_avatar_height
            FROM '
. USERS_TABLE . "
            WHERE user_id = "
. $user->data['user_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result)

Now that you have the required data, you can use the [url=http://area51.phpbb.com/docs/code/phpBB3/_includes---functions_display.php.html#functionget_user_avatar]get_user_avatar[/url] function that’s in includes/functions_display.php

$avatar = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);

Assign $avatar to a template variable.

$template->assign_var('USERS_AVATAR', $avatar)

And finally, add {USERS_AVATAR} into the template page, where you want it to show.

<!-- IF USER_AVATAR -->
            {USER_AVATAR}
            <!-- ELSE -->
            {USER_AVATAR_NONE}
<!-- ENDIF -->

Onovia, hardware, programming ,

  1. HSCharles
    November 15th, 2008 at 23:49 | #1

    I have a flash site
    i’m looking for the script who makes google ads on flash.
    where can i get it?

  1. No trackbacks yet.