$phpbb_root_path = '../forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();Next, we need to include the phpbb functions file so we can run the function "get_user_avatar":
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
//close the current DB connection, where $OPEN_CONNECTION is your MySQL connection
//mysql_close($OPEN_CONNECTION);
//then go to the forum DB and get this user's avatar info
//include your forum's 'config.php' file -- this is custom
//to wherever that file is!!include ('../forum/config.php');//connect to the forum's database
$db2 = mysql_connect($dbhost, $dbuser, $dbpasswd)
or die("Unable to connect to MySQL");
$selected = mysql_select_db($dbname,$db2)
or die("Could not select the database");//here's the SQL query. REPLACE "$USER_ID"
//with the user id you'd like to query.
$sql = 'SELECT `user_avatar`, `user_avatar_type`, `user_avatar_width`,
`user_avatar_height` FROM `phpbb_users`
WHERE `user_id` = ' . $USER_ID . ";
$result2 = mysql_query($sql); $row = mysql_fetch_array($result2);//finally, this will return the avatar
echo get_user_avatar($row['user_avatar'],
$row['user_avatar_type'], $row['user_avatar_width'],
$row['user_avatar_height']);
Writer. Musician. Adventurer. Nerd.
Purveyor of GIFs and dad jokes.