forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 modpack by Stramm => Topic started by: brazzaville on January 09, 2008, 01:54:55 am

Title: setting a default avatar
Post by: brazzaville 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:)
Title: Re: setting a default avatar
Post by: Stramm 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
Title: Re: setting a default avatar
Post by: DaBe 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?
Title: Re: setting a default avatar
Post by: Stramm on January 25, 2008, 09:39:01 pm
I've described above how to code the default avatar mod
Title: Re: setting a default avatar
Post by: DaBe 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?
Title: Re: setting a default avatar
Post by: Stramm 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
Title: Re: setting a default avatar
Post by: gavu 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
Title: Re: setting a default avatar
Post by: DaBe on April 25, 2008, 07:00:34 pm
hello

I search it for comment page and for onlinestats plugin.

is there possible?
Title: Re: setting a default avatar
Post by: Joachim Müller on April 25, 2008, 07:07:24 pm
Then why do you hijack this thread? Stay out of it with totally unrelated issues >:(