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]   Go Down

Author Topic: setting a default avatar  (Read 7343 times)

0 Members and 1 Guest are viewing this topic.

brazzaville

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
setting a default avatar
« on: January 09, 2008, 01:54:55 am »

I've been looking through the forums and found a couple topics about setting a default avatar in a bridged gallery. I'm looking to set a default avatar image for users who don't have one chosen to be displayed by their comments. My PHP skills are minimal but with a little direction I'm sure I could make it work. 

Anyone have any advice on what file to look at to do this?

Thanks in advance:)
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: setting a default avatar
« Reply #1 on: January 09, 2008, 09:18:54 am »

at some places you'll have to look for a check if a valid avatar URL is given... if not, then add your default
eg. in avatar_manage.php

Code: [Select]
if ($avatar_url !="") $avatar_url = "<img src='".$avatar_url."' class=\"image\">";
else $avatar_url="";

make the else reflect your default avatar image like
Code: [Select]
else $avatar_url="<img src='".$CONFIG['ecards_more_pic_target']."images/default_avatar.jpg' class=\"image\">";

other places to look at...
buddy_manage.php
Code: [Select]
if ($i['avatar_url']) {
$avatar_url=AVATAR_PATH.$i['avatar_url'];
$preview = <<<EOT
<img src="$avatar_url" alt="" class="image" /></a>
EOT;
} else {
$preview = "&nbsp;&nbsp;";
}

themes.inc.php
Code: [Select]
if($cpg_udb->can_join()){
if ($CONFIG['enable_avatar']){
        ($row['avatar_url'] != "") ? $avatar_url= "<img src='".AVATAR_PATH.$row["avatar_url"]."' class='image' style='float: left; margin-right: 5px;' alt='' />" : $avatar_url = '';
}
else $avatar_url="";
} else { // only used when tables can't be joined... then we need to query for the avatar URL -> function get_avatar
if ($CONFIG['enable_avatar']){
$result2 = $cpg_udb->get_avatar($row['author_id']);
$avatar_url= preg_replace('/\/\//','/',AVATAR_PATH.$result2["avatar_url"]);
        ($result2['avatar_url'] != "") ? $avatar_url= "<img src='".$avatar_url."' class='image' style='float: left; margin-right: 5px;' alt='' />" : $avatar_url = '';
}
else $avatar_url="";
}

pms.php
Code: [Select]
if ($CONFIG['enable_avatar']){
        ($cur_post['avatar_url'] != "") ? $avatar_url= "<br /><br /><img src='".$cur_post["avatar_url"]."' class='image' width='".$CONFIG['mini_thumb_width']."' height='".$CONFIG['mini_thumb_height']."'>" : $avatar_url = '';
}

profile.php
Code: [Select]
if ($CONFIG['enable_avatar']) {
if (AVATAR_URL !="") $avatar_url = "<a href='avatar_manage.php'><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\">";
}
}
and
Code: [Select]
if ($CONFIG['enable_avatar'] && $avatar_url !="") {
if ($avatar_url) $display_profile_form_param[] = array('textplain', $avatar_url,"User Avatar");
}


I think that's all.. pretty easy to change

DaBe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 110
Re: setting a default avatar
« Reply #2 on: January 25, 2008, 08:09:01 pm »

hello stramm..

how did you mean that?

I search also a default avatar mod, when an user choose a avatar than display that, when not should display a default avatatar..is this avaible?
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: setting a default avatar
« Reply #3 on: January 25, 2008, 09:39:01 pm »

I've described above how to code the default avatar mod

DaBe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 110
Re: setting a default avatar
« Reply #4 on: January 26, 2008, 09:58:06 am »

yes but...must I replace the code with another or paste the code in the php files..and where exactly I must paste the code?
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: setting a default avatar
« Reply #5 on: January 27, 2008, 11:42:50 am »

lol, that's more than the advice you asked for in your first post

Next time I'm bored I'll come up with the changes

gavu

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
    • SibiuWall
Re: setting a default avatar
« Reply #6 on: April 06, 2008, 08:45:06 pm »

it worked perfect for me too,

is there a way to set default_avatar on the comments page too?

thanks
Logged
it's not a bug, it's a feature

DaBe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 110
Re: setting a default avatar
« Reply #7 on: April 25, 2008, 07:00:34 pm »

hello

I search it for comment page and for onlinestats plugin.

is there possible?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: setting a default avatar
« Reply #8 on: April 25, 2008, 07:07:24 pm »

Then why do you hijack this thread? Stay out of it with totally unrelated issues >:(
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 21 queries.