setting a default avatar setting a default avatar
 

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

setting a default avatar

Started by brazzaville, January 09, 2008, 01:54:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brazzaville

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:)

Stramm

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

if ($avatar_url !="") $avatar_url = "<img src='".$avatar_url."' class=\"image\">";
else $avatar_url="";


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


other places to look at...
buddy_manage.php
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
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
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
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
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

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?

Stramm

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

DaBe

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?

Stramm

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

it worked perfect for me too,

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

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

DaBe

hello

I search it for comment page and for onlinestats plugin.

is there possible?

Joachim Müller

Then why do you hijack this thread? Stay out of it with totally unrelated issues >:(