Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: Getting Member Avatars to be Displayed in index.php ?  (Read 17785 times)

0 Members and 1 Guest are viewing this topic.

obitsu

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Getting Member Avatars to be Displayed in index.php ?
« on: September 07, 2007, 06:49:27 am »

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!
« Last Edit: September 18, 2007, 09:13:07 pm by Stramm »
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #1 on: September 17, 2007, 10:03:55 pm »

Same has been asked here
http://forum.coppermine-gallery.net/index.php?topic=46865.0

Probably I'll post a code sample when I have some time again

Farnsi

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 177
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #2 on: September 18, 2007, 12:07:49 am »

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..
Logged
Regards,
Farnsi

flowmo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #3 on: September 18, 2007, 06:01:16 am »

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
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #4 on: September 18, 2007, 06:39:39 pm »

paste following code into the theme.php you're using right before the final ?>

Code: [Select]
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #5 on: September 18, 2007, 09:10:37 pm »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #6 on: September 19, 2007, 08:31:27 am »

Logged

flowmo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #7 on: September 21, 2007, 06:50:39 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
Logged

lobosden

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #8 on: September 27, 2007, 11:04:54 pm »

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

???
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #9 on: September 27, 2007, 11:12:44 pm »

post a link and describe what you did

lobosden

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #10 on: September 27, 2007, 11:16:09 pm »

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

www.bodyarttalk.com
Logged

lobosden

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #11 on: September 27, 2007, 11:17:04 pm »

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

lobosden

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #12 on: September 27, 2007, 11:20:44 pm »

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.
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #13 on: September 27, 2007, 11:23:10 pm »

hmm.. a testuser account would be helpful ;)

lobosden

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #14 on: September 27, 2007, 11:27:57 pm »

sorry I had one and deleted it had to remake it

test
test123
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #15 on: September 27, 2007, 11:41:16 pm »

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

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #16 on: September 27, 2007, 11:44:25 pm »

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?
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #17 on: September 27, 2007, 11:49:32 pm »

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

lobosden

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 75
Re: Getting Member Avatars to be Displayed in index.php ?
« Reply #18 on: September 27, 2007, 11:54:31 pm »

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

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Pages: [1] 2   Go Up
 

Page created in 0.025 seconds with 20 queries.