Customizing SMF > Modifications and Packages

Avatars @ Index

(1/37) > >>

4LP3RUZ1:
Link to Mod

Avatars @ Index
By alperuzi
version: 1.5

The Avatars at Index modification lets you show the topic starters' avatars next to their name on the message index.

Note: This post may be outdated, for the latest features and news, see the modification page.

Features:

-> You can enable or disable this mod in "Admin > Features and Options > Layout and Options"
-> You ca set the avatar's height and/or width. The avatar will scale to either if the other value is left blank. Setting none of these values will result in full size avatars!

DON'T FORGET TO ENABLE THE MOD FROM THE ADMIN PANEL "Admin > Features and Options > Layout and Options"

If you have any problems, questions or comments, please ask them here.

------------------------------------------------------------------------------------------------

Avatars at Index modifikasyonu mesaj indeksinde konu başlatan üyelerinin isimlerinin yanında avatarlarının çıkmasını sağlar.

Özellikleri:

-> Yönetici panelinden bu modifikasyonu etkinleştirip devre dışı bırakabilirsiniz: "Yönetici Paneli > Forum Seçenekleri > Düzen ve Seçenekler"
-> Gösterilecek avatarların yükseklik ve/veya genişliklerini ayarlayabilirsiniz. Avatar bu iki ayardan biri ile ölçeklenebileceği gibi (diğer değeri boş bırakılırsa), her iki yönde de ölçeklenebilir. Yükseklik veya genişlik belirtilmez ise tam boyutta avatarlar kullanılır!

MODİFİKASYONU YÖNETİCİ PANELİNDEN ETKİNLEŞTİRMEYİ UNUTMAYIN! "Yönetici Paneli > Forum Seçenekleri > Düzen ve Seçenekler"

Problem veya sorularınızı Türkçe olarak dile getirmek istiyorsanız LÜTFEN BU KONUYU KULLANMAYIN! Türkçe bölümündeki bu konuyu kullanın!
If you want to show a default avatar for users without one:

OK, heres what we have to do.
In the modified /Sources/MessageIndex.php file find the following line:

--- Code: ---'avatar' => $mini_avatar['avatar'] == '' ? ($mini_avatar['ID_ATTACH'] > 0 ? '<img src="' . (empty($mini_avatar['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $mini_avatar['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $mini_avatar['filename']) . '" alt="" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />' : '') : (stristr($mini_avatar['avatar'], 'http://') ? '<img src="' . $mini_avatar['avatar'] . '" alt="" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($mini_avatar['avatar']) . '" alt="" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />'),  // Avatars at Index By alperuzi
--- End code ---

Now we are going to dissect this code very carefully.

See where there are two single quotes in the middle of this code?
--- Quote ---border="0" />' : '') : (stristr(
--- End quote ---

you need to add this code in the middle of the single quotes (change the filename from default.gif to anything you want:
--- Code: ---<img src="'.$modSettings['avatar_url'].'/default.gif" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />
--- End code ---

so the final code looks like this:

--- Code: ---'avatar' => $mini_avatar['avatar'] == '' ? ($mini_avatar['ID_ATTACH'] > 0 ? '<img src="' . (empty($mini_avatar['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $mini_avatar['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $mini_avatar['filename']) . '" alt="" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />' : '<img src="'.$modSettings['avatar_url'].'/default.gif" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />') : (stristr($mini_avatar['avatar'], 'http://') ? '<img src="' . $mini_avatar['avatar'] . '" alt="" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($mini_avatar['avatar']) . '" alt="" height="'.$modSettings['miniAvatarHeight'] .'px" width="'.$modSettings['miniAvatarWidth'] .'px" align="absmiddle" border="0" />'),  // Avatars at Index By alperuzi
--- End code ---
Note that the default avatar file must be in the same folder as your avatars, traditionally /avatars

If you also want this default avatar to be shown in the members-list, look at this post.
Edits to other Themes:


* Helios MC, Amber and possibly Bloc's other themes
* Mercury by Bloc
* DilberMC

Carlos Gandra:
Well done!

How to install it with other themes? ;) I've open the xml file to find the code, but it returns me an error, maybe some turkish characters that my system don't recognize ???

Thanks,
AC

4LP3RUZ1:
well basically you'll need to add a
--- Code: --- $topic['first_post']['member']['avatar']
--- End code ---
to wherever you think looks nice :)

--- Code: ---$topic['first_post']['member']['link']
--- End code ---
is where the topic starter is written to screen so around that would be a good idea :)
Plus you can (and should) do a check for
--- Code: ---$modSettings['enable_mini_avatars']
--- End code ---
which is the admin panel functionality

The other changes I have added to the default MessageIndex.template.php file is so that the avatar and name go into a "mini table" of two cells, they are in fact optional but makes it look nicer ;)

There are no foreign characters on the source code and variables that I know of, but the tabling part may need to change to fit other themes.

frankeistein:
thanks alperuzi ;D

char39:
This is an excellent idea!  However, it doesn't work for me.  It said that it downloaded ok, and I have it set in the Layout and Options, but they don't show on the forum.  I am assuming it only works in the default theme?

Navigation

[0] Message Index

[#] Next page

Go to full version