Seite 1 von 1

phpBB3 Avatar von User Auslesen

Verfasst: 16.08.2007 11:00
von Elvis
Hallo,
könnte mir jemand erklären wie man die Avatare der User auslesen kann um es anzuzeigen ?

bei phpBB2 habe ich das so gemacht

Code: Alles auswählen

$sql = "SELECT user_avatar, user_avatar_type
	FROM " . USERS_TABLE . "
    WHERE user_id = ".$impressum['web_id']; 

	if ( !($result = $db->sql_query($sql)) )
	{
   	message_die(GENERAL_ERROR, "Geht nicht.. warum auch immer", '', __LINE__, __FILE__, $sql);
	}

	$web_avatar_info = $db->sql_fetchrow($result);
	$web_avatar = '';

	switch( $web_avatar_info['user_avatar_type'] )
	{
   	case USER_AVATAR_UPLOAD:
    $web_avatar = '<img src="' . $board_config['avatar_path'] . '/' . $web_avatar_info['user_avatar'] . '" alt="" border="0" />';
    break;
   	case USER_AVATAR_REMOTE:
    $web_avatar =  '<img src="' . $web_avatar_info['user_avatar'] . '" alt="" border="0" />';
    break;
   	case USER_AVATAR_GALLERY:
    $web_avatar = '<img src="' . $board_config['avatar_gallery_path'] . '/' . $web_avatar_info['user_avatar'] . '" alt="" border="0" />';
    break;
	}
beim 3er weis ich nicht mal wie ich anfangen soll :/

Verfasst: 16.08.2007 12:40
von tas2580
Versuch mal

Code: Alles auswählen

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

// Start session management
$user->session_begin();
$user->setup();

// Select some Userdata from DB
$sql = 'SELECT 
		user_avatar,
		user_avatar_type,
		user_avatar_width,
		user_avatar_height
	FROM ' . USERS_TABLE . ' 
	WHERE user_id = '. (int) $userid;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);

$theme_path = "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme';
$avatar = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);

Verfasst: 16.08.2007 20:57
von Elvis
Dank dir.