/ development

Encouraging Gravatar Use in Wordpress Multisite

We're in the process of redesigning the layout and look of UMW Blogs and one of the features Martha Burtis has added is a stream of the 5 latests posts from the entire network. The plugin is pulling the user's Gravatar along with the title, author, a character-limited description, and link to read the full post. Gravatars are built into Wordpress and have been for awhile and it's adds quite a bit of personality to the design to feature them in the stream.That being said after a first stab at designing the look of the sidebar, we immediately noticed a problem. Most people don't register their email address with a profile picture on Gravatar's website, leaving them with a default icon. So much for personality. Gravatar offers a few randomized images instead of a single default image for users that aren't registered, but none of them are incredibly attractive. We settled on Identicons but we knew we would want to figure out a way to encourage users to register an email address with Gravatar and upload their own image. Encouraging registration is not an easy task, mostly because Gravatar is a third-party website requiring a separate registration (although all they need is an email address to get a user started). After a bit of searching I happened to come across a plugin called (appropriately) Gravatar Signup Encouragement. It has quite a few options for encouraging users to register a Gravatar and in every case it checks a user's email address against the Gravatar site to see whether or not they are already registered. You can enable it for commenting on forms, site registration, user signup (particularly useful for Multisite installs), and/or as an admin notification. The plugin notifies the user that their email address is not registered and offers a link to register on Gravatar's site with their email address already filled in for them. We opted to only enable the admin notification, thinking that most users who are using their blog would find the prominent notification enough encouragement to quickly register their e-mail address and upload a picture. It will be interesting to see over the course of the first few weeks of school if the plugin works well to encourage adoption of Gravatars. In order to get the plugin to work with our system I did have to make a few minor modifications which I'll detail here for anyone looking for a similar use case. The plugin needs to be active for all users, which means it had to be put in the wp-content/mu-plugins folder. The plugin itself consists of a folder with several files, however setting up must-use plugins means moving the main php file directly into the mu-plugins folder or it won't work. Here's the workaround for that. Download, unzip, and copy the entire plugin folder inside of mu-plugins. Then take the gravatar-signup-encouragment.php file out of that plugin's folder and place it directly in mu-plugins. You will need to edit that file now to add the relative path /gravatar-signup-encouragement/ to any calls to the other files (since the rest of the files are still in the plugin's own folder). At the time of this blog post these are the following lines that need to be changed and the new text:

  • Line 41 - '/gravatar-signup-encouragement/gravatar-check.php'
  • Line 50 - '/gravatar-signup-encouragement/translations'
  • Line 68 - '/gravatar-signup-encouragement/translations
  • Line 106 - '/gravatar-signup-encouragement/translations'
  • Line 144 - '/gravatar-signup-encouragement/translations'
  • Line 325 - '/gravatar-signup-encouragement/screenshot-2.jpg'
  • Line 358 - '/gravatar-signup-encouragement/screenshot-3.jpg'
  • Line 389 - '/gravatar-signup-encouragement/screenshot-4.jpg'
  • Line 394 - '/gravatar-signup-encouragement/screenshot-5.jpg'
  • Line 399 - '/gravatar-signup-encouragement/screenshot-6.jpg'
  • Line 404 - '/gravatar-signup-encouragement/screenshot-7.jpg'
  • Line 439 - '/gravatar-signup-encouragement/screenshot-8.jpg'
  • Line 461 - '/gravatar-signup-encouragement/screenshot-9.jpg'

The other necessary change is to the default enabled settings. By default the plugin has the option to notify unregistered commenters but leaves the rest of the options unchecked (all options are found under Settings>Discussion). We wanted to only have the option checked to notify the user within the admin panel (since we really only care about the author of the blog, although ultimately encouraging commenters to register a Gravatar is a great option for individual blogs to enable). The default options are in the same php file at Line 128 (at the time of this post) and the defaults are as follows: > $gse_options['show_comments_unreg'] = '1'; $gse_options['below_comments_unreg'] = '#comment'; $gse_options['below_comments_reg'] = '#comment'; $gse_options['below_profile'] = 'h2'; $gse_options['below_registration'] = '#user_email'; if ( function_exists('is_multisite') && is_multisite() ) { $gse_options['below_ms_signup'] = '#user_email'; }

Changing the '1' to a '0' will keep the unregistered commenter option unchecked by default. To add a checkmark for admin notifications add this line below it: > $gse_options['show_in_admin_notices'] = '1';

You can also adjust the text the plugin uses to notify the user on Line 71: > $message = sprintf(__("You haven't setup a profile picture with your e-mail address yet. This picture is used in comments and posts across all UMW Blogs sites. If you would like to setup your profile picture, click here (link opens in new tab/window).", "gse_textdomain"), 'URL');

Now the plugin will propagate to all users and when they log into their blog if they are registered with Gravatar already they will never notice it (unless they dig into the Discussions area) but if they're not registered yet they will get a notification like the one in the screenshot below (click for full-size), hopefully encouraging them to head over and update their profile picture, if for no other reason than for the notification to disappear.