Customizing SMF > SMF Coding Discussion

noavatar.gif

(1/2) > >>

† ÐëepÇuT¹ †:


Wish to make that (or a image from my image directory) show up for a person who has no avatar.

TXSherry:
Okay, in the theme you want to modify, if the 'blank user' is yourtheme/images/blankone.jpg
Make a copy of Themes/default/Display.template.php to
Themes/yourtheme/Display.template.php

and edit this one Themes/yourtheme/Display.template.php (leave default alone)

find this:

--- Code: ---// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars'])
                                                   && !empty($message['member']['avatar']['image']))
    echo '
   <div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';

--- End code ---

Replace with this:

--- Code: ---//Set up a blank avatar for those "without"
    if (empty($message['member']['avatar']['image']))
           $useavatar='<img src="' . $settings['actual_theme_url']
                               . '/images/blankone.jpg" />';
    else
           $useavatar=$message['member']['avatar']['image'];

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) )
        echo '<div style="overflow: auto; width: 100%;">'
                . $useavatar . '</div><br />';


--- End code ---

If you want to do it across the board, I would guess you might do it in Sources/Display.template.php
or you might do it in Themes/default/Display.template.php
But, i haven't tested those so wouldn't recommend 'em.   If you do modify those, please back them up first.  :)

HTH,
Sherry

Chris Cromer:
All you have to do is save that image as blank.gif and place it in the avatars directory, no need to alter any code. ;)

TXSherry:
In the words of Homer...


DoH!


[Unknown]:

--- Quote from: Chris Cromer on August 17, 2004, 12:36:25 PM ---All you have to do is save that image as blank.gif and place it in the avatars directory, no need to alter any code. ;)

--- End quote ---

Umm, I don't believe that works in SMF.

-[Unknown]

Navigation

[0] Message Index

[#] Next page

Go to full version