Getting Member Avatars to be Displayed in index.php ? Getting Member Avatars to be Displayed in index.php ?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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.

obitsu

Hello!

I recently started using Coppermine and am really liking it. I installed the modpack to enable use of avatars, and so far, I've gotten them working on the comments, profile page, etc., but I was also wanting to have it shown on the front page (index.php) after the registered user logs in, so they see their name and their avatar.

How do I do this code-wise? ???

I'm a novice when it comes to PHP scripting, especially anything beyond simple theme modifications. My theme is based off of the "hardwired" coppermine theme if that helps any.

Thanks for any tips!

Stramm


Farnsi

that would be awesome! It is a really cool idea.
I searched a little bit for the things you said in the other thread but i am too "php-dumb" for that.  ::)
perhaps i'll have another try tomorrow, when i'm not that tired..
Regards,
Farnsi

flowmo

I'm currently working on this myself and will have something in a week.. my sites new design is totally dependent upon this feature so if I can't figure out a solution, I will pay someone to do this within a week, so check back for a solution..

I am bridge with phpbb and thats where my avatars come from, so my current ideas are:

-Re-write stramms call for the avatar as done for comments (though the code is rather confusing to me, and I'm not sure how it would be rewritten for using the logged users id as opposed to the comment author, as it pulls avatar by comment author and not user id)
-Query phpbb tables for avatar URL
-Use phpbb fetch all to get avatar - CPU killing method...

If I don't come up with something within the next 2 days I'll pay someone on DP to re-write stramms code for the avatar and post it here.. unless someone here wants to do it for compensation (sorry if that is not allowed)  :P

Stramm

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;
}

flowmo

stramm send me a paypal id you just saved me a lot of time

Joachim Müller


flowmo

Quote from: GauGau on September 19, 2007, 08:31:27 AM
We need your help *wink*

Man trust me, I'd be the first to donate to you guys if you took donations..

And I would definitely sponsor a cache mod ;-).. though it looks impossible..

From now on though, I'll keep track of modifications I make to coppermine and post them here

Sorry to hijack

lobosden

O.K. I did this and all was good until you clicked on someones name to see their profile and it gave a error trying to send it to theme.php

???

Stramm


lobosden

well I took it down but I will put it up again real quick...lol

www.bodyarttalk.com

lobosden

I posted the below code before the final ?> SO THE AVATAR will show.

lobosden

Yea its back up now.... I see my avatar next to the messages.

But if I click on someones name to see thier profile It errors out.

Stramm


lobosden

sorry I had one and deleted it had to remake it

test
test123

Stramm

your problem is that the profile doesn't display anymore when this avatar feature is in the theme.php?

hmmm, seems to be some incompatibility in either theme.php, template.html or even mods in profile.php ... can't tell you 100% cause I do not know your changes

at least I can tell you that profile.php shows either some frameset code or some javascript that's not part of coppermine

have you tried to add the code to the classic theme.php and try that?

lobosden

Yea, it works there, just the roll over is too confusing, people in my industry aren't very computer literate lol.

So I use this one and it's "KEWL" you know and user friendly. I will just take it out, all it does is post your ava at the top.

Is there away to maybe put users avatars that are online in the anycontent?

Stramm

possible, there's already a similar thread open that asks for that... maybe I have time to bring up a quick hack soon


lobosden

I'm sure I will be needing that paypal button from you before I am threw lol.
;)