News:

Join the Facebook Fan Page.

Main Menu

Gravatar Mod

Started by Nibogo, September 24, 2012, 08:24:13 PM

Previous topic - Next topic

Nibogo


Gravatar - NIBOGO
Allows users to set their gravatar as the avatar for your forum





Important Info:
o This Mod was created by SMFPacks.com - The #1 Website for the Customziation of your SMF.

SMFPacks.com Provides Other Great Packages:
- Reason for Editing Mod.
- Yet Another Global Announcements Mod.
- SMF Social Groups.
- SMF Links Directory.
- SMF Downloads Directory.
- SMF Dynamic Directory.
- Advanced Topic Prefix Mod.
- Advanced Invitations System.
- Move Topic Notification.
- PM to New Members.
- Permissions Info.
- Next Post Level.
- Karma Buttons.
- SMF Multi Quote.
- Attachments in Topics.
- and much more visit us on SMFPacks.com

Author and Developer:
- NIBOGO

Features:
o Users can select gravatar as their avatar
o Admin can customize what ratings are allowed
o Admin can customize the size of the gravatar
o Permissions include it

Compatibility:
- 2.0




Changelog:

1.0 - 27th July 2012
o Initial Public Release

Hj Ahmad Rasyid Hj Ismail

Nice one. Congrats. This could be another very useful and popular mod.

ArsenArsen

How to make it work with SimplePortal

nend

I know this is a old mod, but fixed a few bugs. Mainly the operators where wrong and brackets in the wrong place. This bug caused Gravatar to show all the time even if it wasn't selected in the profile options.  ;)

Display.php
This
'avatar' => array(
'name' => $profile['avatar'],
'image' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img class="avatar" src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : ($profile['avatar'] === 'gravatar') ? '<img class="avatar" src="' . get_gravatar($profile['email_address']) . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" />'),
'href' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : ($profile['avatar'] === 'gravatar') ? get_gravatar($profile['email_address']) : $modSettings['avatar_url'] . '/' . $profile['avatar']),
'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : ($profile['avatar'] === 'gravatar') ? get_gravatar($profile['email_address']) : $modSettings['avatar_url'] . '/' . $profile['avatar'])
),

To
'avatar' => array(
'name' => $profile['avatar'],
'image' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" />' : '') : (stristr($profile['avatar'], 'http://') ? '<img class="avatar" src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : ($profile['avatar'] == 'gravatar' ? '<img class="avatar" src="' . get_gravatar($profile['email_address']) . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" />')),
'href' => $profile['avatar'] == '' ? ($profile['id_attach'] > 0 ? (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : ($profile['avatar'] == 'gravatar' ? get_gravatar($profile['email_address']) : $modSettings['avatar_url'] . '/' . $profile['avatar'])),
'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : ($profile['avatar'] == 'gravatar' ? get_gravatar($profile['email_address']) : $modSettings['avatar_url'] . '/' . $profile['avatar']))
),

This
'avatar' => array(
'url' => isset($user_settings['avatar']) && $user_settings['avatar'] === 'gravatar' && isset($user_settings['email_address']) ? get_gravatar($user_settings['email_address']) : (isset($user_settings['avatar']) ? $user_settings['avatar'] : ''),
'filename' => empty($user_settings['filename']) ? '' : $user_settings['filename'],
'custom_dir' => !empty($user_settings['attachment_type']) && $user_settings['attachment_type'] == 1,
'id_attach' => isset($user_settings['id_attach']) ? $user_settings['id_attach'] : 0
),

To
'avatar' => array(
'url' => isset($user_settings['avatar']) && $user_settings['avatar'] == 'gravatar' && isset($user_settings['email_address']) ? get_gravatar($user_settings['email_address']) : (isset($user_settings['avatar']) ? $user_settings['avatar'] : ''),
'filename' => empty($user_settings['filename']) ? '' : $user_settings['filename'],
'custom_dir' => !empty($user_settings['attachment_type']) && $user_settings['attachment_type'] == 1,
'id_attach' => isset($user_settings['id_attach']) ? $user_settings['id_attach'] : 0
),

SniperFodder

I modified the get_gravatar() Function to use the base URL to use HTTPS instead of HTTP. Maybe if there was an option to select which protocol the admin wanted to use?

I did this to ensure the full site was running HTTPS and not mixed content.

SniperFodder

Discovered that the changes I made aren't working so well. It seems to be setting the Avatar URL to the following https://example.forum.com/avatars/https://www.gravatar.com/avatar/5e3988d2a20395270b7684133301beca?s=80&amp;r=P

I've had to build in the following Rewrite Condition to my apache to fix it.


    RewriteCond %{REQUEST_URI} ^/avatars/(https://www.gravatar.com/avatar/.*)$
    RewriteRule (.*) %1 [L]


I don't know enough PHP to fix it in the mod installation D:


Advertisement: