Advertisement:

Navigation

Readme

Author : Dragooon
Version : 1.1.1
Name : Default Avatar
Tested with : 1.1.5, 2.0 Beta 3 Public



If a user's avatar's field is empty, This mod replaces the avatar with a standard avatar which can be set via Admin > Attachments And Avatars > Avatars.
The avatar URL you set HAVE to be a URL, Not a Path to the image.

The default avatar will appear at every place where the avatar is shown.



Changelog

Version 1.0
  • Initial Release


Version 1.1
  • Took all the changes from templates to Source files
  • Now doesn't require any template changes, only sources file and this works with every theme, also it now replaces the avatar everywhere.
  • Added support for SMF 2 Beta 3 public


Version 1.1.1
  • Fixed a bug in which user uploaded avatars were not being shown
  • Added swedish translation




Thank you for using this mod! :)

File Edits

./Sources/ManageAttachments.php

Find: [Select]
'custom_avatar_enabled' => empty($_POST['custom_avatar_enabled']) ? '0' : '1',
Add After: [Select]
'attachmentDefaultavatar' => $_POST['attachmentDefaultavatar'],

./Themes/default/ManageAttachments.template.php

Find: [Select]
<tr class="windowbg2">
<td colspan="2" align="center">
<input type="submit" name="avatarSettings" value="', $txt['attachment_manager_save'], '" />
<input type="hidden" name="sa" value="avatars" />
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</td>
</tr>
Add Before: [Select]
<tr class = "titlebg">
<td colspan="2">',$txt['default_avatar_header'],'</td>
</tr>
<tr class="windowbg2">
<td width="50%" align="right"><label for="attachmentDefaultavatar">',$txt['default_avatar_settings'],'</label>:<br/>
<span class="smalltext">', $txt['default_avatar_subtxt'], '</span></td>
<td><input type="text" name="attachmentDefaultavatar" id="attachmentDefaultavatar" value="', empty($modSettings['attachmentDefaultavatar']) ? '' : $modSettings['attachmentDefaultavatar'], '" size="40" /></td></tr>


./Themes/default/languages/Modifications.english.php

Find: [Select]
?>
Add Before: [Select]

//Default Avatar Strings
$txt['default_avatar_header'] = 'Default Avatar';
$txt['default_avatar_settings'] = 'Default Avatar URL';
$txt['default_avatar_subtxt'] = 'If the User\'s avatar\'s field is empty, the avatar from this link is shown. Please Do NOT enter a path, it should be a link';

./Themes/default/languages/Modifications.greek.php

Find: [Select]
?>
Add Before: [Select]

//Default Avatar Strings
$txt['default_avatar_header'] = 'Προεπιλεγμένο Πορτραίτο';
$txt['default_avatar_settings'] = 'Διεύθυνση Προεπιλεγμένου Πορτραίτου';
$txt['default_avatar_subtxt'] = 'Αν το πεδίο πορτραίτου του χρήστη είναι κενό, εμφανίζεται το πορτραίτο αυτής της διεύθυνσης. Παρακαλούμε ΜΗΝ εισάγετε διαδρομή, εισάγετε διεύθυνση!';
This operation isn't vital to the installation of this mod.

./Themes/default/languages/Modifications.swedish.php

Find: [Select]
?>
Add Before: [Select]

//Default Avatar Strings
$txt['default_avatar_header'] = 'Standard medlemsbild';
$txt['default_avatar_settings'] = 'URL till standard medlemsbilden';
$txt['default_avatar_subtxt'] = 'Om medlemens avatarf&auml;lt &auml;r tomt, visas denna medlemsbild. Skriv inte in en s&ouml;kv&auml;g, det m&aring;ste vara en l&auml;nk';
This operation isn't vital to the installation of this mod.

./Themes/default/languages/Modifications.turkish.php

Find: [Select]
?>
Add Before: [Select]

//Default Avatar Strings
$txt['default_avatar_header'] = 'Varsayılan Avatar';
$txt['default_avatar_settings'] = 'Varsayılan Avatar URL\'si';
$txt['default_avatar_subtxt'] = 'Eğer üyenizin avatarı yoksa linkteki avatar görülecek. Lütfen tam linki yazın';
This operation isn't vital to the installation of this mod.

./Sources/Load.php

Find: [Select]
// Set up the $user_info array.
Add Before: [Select]

if(((!isset($user_settings['avatar']) || empty($user_settings['avatar'])) && (!isset($user_settings['ID_ATTACH']) || $user_settings['ID_ATTACH'] == 0)) && !empty($modSettings['attachmentDefaultavatar']))
$user_settings['avatar'] = $modSettings['attachmentDefaultavatar'];

Find: [Select]
// What a monstrous array...
Replace With: [Select]

if(((!isset($profile['avatar']) || empty($profile['avatar'])) && (!isset($profile['ID_ATTACH']) || $profile['ID_ATTACH'] == 0)) && !empty($modSettings['attachmentDefaultavatar']))
$profile['avatar'] = $modSettings['attachmentDefaultavatar'];

Code

install.php

This file should not be able to execute standalone. You may have to run the following queries manually.

Query: [Select]
INSERT IGNORE INTO {$db_prefix}settings (variable) VALUES ('attachmentDefaultavatar')