Getting Member Avatars to be Displayed in index.php ? - Page 2 Getting Member Avatars to be Displayed in index.php ? - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Getting Member Avatars to be Displayed in index.php ?

Started by obitsu, September 07, 2007, 06:49:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dumbo

Quote from: Stramm on September 18, 2007, 06:39:39 PM
paste following code into the theme.php you're using right before the final ?>

function loginForm($logged=1) {

global $CONFIG, $lang_loginform, $REFERER;

//if (!$CONFIG['enable_loginform']) return $loginFormHtml = "";

if (!USER_ID && $CONFIG['enable_loginform']) {
  $loginFormHtml = <<<EOT
<ins>
    <form action="login.php?referer=$REFERER" method="post" name="loginbox" style="margin:0; padding:0;">
        <table cellpadding="0" cellspacing="3" border="0">
        <tr>
            <td><input type="text" class="textinput" name="username" size="10" /></td>
            <td><input type="password" class="textinput" name="password" size="10" /></td>
            <td><input name="submitted" type="submit" value="Login" />
            <input name="remember_me" type="hidden" class="checkbox" value="1" checked="checked" /></td>
        </tr>
        <tr>
        <td class="smallfont">$lang_loginform[user]</td>
        <td class="smallfont">$lang_loginform[pass]</td>
        <td></td>
</tr>
        </table>
        </form>
</ins>
EOT;
}

if (USER_ID) {

if ($CONFIG['enable_avatar']) {
if (AVATAR_URL !="") $avatar_url = "<a href='profile.php?op=edit_profile'><img src='".AVATAR_PATH.AVATAR_URL."' class=\"image\"></a>";
else $avatar_url="&nbsp;";
    $edit_profile_form_param[] = array('textplain', $avatar_url, $lang_register_php['manage_avatar']);

if (isset($_GET['uid'])) {
$user_data = $cpg_udb->get_user_infos($_GET['uid']);
$avatar_url = $user_data['avatar_url'];
if ($avatar_url !="") $avatar_url = "<img src='".AVATAR_PATH.$avatar_url."' class=\"image\">";
}
$loginFormHtml = "<span style=\"float: right\">".$avatar_url."</span>";
} else $loginFormHtml = NULL;

$loginFormHtml .= "<div align=\"right\" class=\"smallfont\">".$lang_loginform['welcome']." <strong>".(USER_NAME)."&nbsp;</strong><br />";


if ($CONFIG['display_pms_status']){
$result = cpg_db_query("SELECT count(*) FROM  {$CONFIG['TABLE_PMS']} WHERE owner=".(USER_ID));
list($tot_all_messages) = @mysql_fetch_array($result);
mysql_free_result($result);
$result = cpg_db_query("SELECT count(*) FROM  {$CONFIG['TABLE_PMS']} WHERE owner=".(USER_ID)." AND showed='0'");
list($tot_new_messages) = @mysql_fetch_array($result);
mysql_free_result($result);

if ($CONFIG['pms_enabled']) {
$loginFormHtml .= "<a href='pms.php'>".$lang_loginform['pms']."</a> ".$tot_new_messages.$lang_loginform['unread_total'].$tot_all_messages."&nbsp;</div>";
}
}

if ($CONFIG['display_buddy_status']){
// get some buddy data
$result = cpg_db_query("SELECT count(*) FROM  {$CONFIG['TABLE_BUDDY']} WHERE user_id=".(USER_ID));
list($tot_all_buddies) = @mysql_fetch_array($result);
mysql_free_result($result);
$result = cpg_db_query("SELECT count(*) FROM  {$CONFIG['TABLE_BUDDY_REQ']} WHERE buddy_to=".(USER_ID));
list($tot_new_buddies) = @mysql_fetch_array($result);
mysql_free_result($result);

if ($CONFIG['enable_buddy']){
$loginFormHtml .= "<div align=\"right\" class=\"smallfont\"><a href='buddy_manage.php'>".$lang_loginform['friends'].":</a> ".$tot_new_buddies." ".$lang_loginform['request'].", ".$lang_loginform['active']." ".$tot_all_buddies."&nbsp;</div>";
}
}

}
  return $loginFormHtml;
}


works fine Stram but when we click on the use names from the user list or the online status it shows error ...else things working fine , please tell me how to fix this , i tried the above mentioned codes exactly

dumbo

also plaicing avatar image using place holder possible  :) , i am new to php

Stramm

possible... but then you have to do a lil bit more coding

dumbo

Please do it staramm actually now i got to complete my Aero theme at any cost :)
Got to get that control on avatar's positioning ..would be great if its has a place holder. once this is done lil work on my skin also will be completed

I wish i Knew php  :'(

Working on a gif based theme for sick IE :) .

dumbo

Stramm Hope u have read through the erron i am getting , its on reply 20...

seros

I tried to apply this code in the theme.php (oranje theme) but actually the avatar s shown, BUT if I click on my profile i just get empty white pages.
So where can I find the login form which is already somewhere in some file? I think I need to make changes in there.
Thanks Stramm :)


Joachim Müller

Why don't you tell us how you solved your issue for the benfit of others with similar issues? That's the point of a support board.

seros

#28
Late at night I was just too tired, sorry. Hope this is the solution, for me it worked.

remove this part from the code:
if (isset($_GET['uid'])) {
$user_data = $cpg_udb->get_user_infos($_GET['uid']);
$avatar_url = $user_data['avatar_url'];
if ($avatar_url !="") $avatar_url = "<img src='".AVATAR_PATH.$avatar_url."' class=\"image\">";
}