WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Making Identicons from IP addresses, not email addresses

[Resolved] Making Identicons from IP addresses, not email addresses

  • I asked about this before but got no responses. I am hoping people are less busy now than right after the last major WP version was released.

    While I am a big fan of Identicons, I want those on my site to be based on IP addresses, not the email addresses people supply. That way, it is easy to see which comments have been made from a particular computer – a feature I find more useful than having icons based on whatever commenters care to input as an email address.

    Is there any way to alter the WordPress code so that Identicons are generated in this way? I am running version 2.6.1.

    Many thanks for any assistance,

    Milan
    http://www.sindark.com

Viewing 13 replies - 1 through 13 (of 13 total)
  • Short answer: no.

    Long answer: Yes, but you lose the ability for people to use their own custom avatars, because you’re not using their email address anymore.

    Extended answer: Not a great idea anyway, because most people’s IP addresses change frequently, or they’re sharing one external IP throughout their company/office/location…

    The WP_Identicon plugin written by Scott Sherrill-Mix created Identicons using IP addresses, but did not prevent users who had set up Gravatars from using those.

    Right now, visitors to my site who have Gravatars have those shown beside their comments. Those who do not have Identicons created from email addresses. It seems like it should be possible to change the basis of Identicon creation without changing how Gravatars are treated.

    On the issue of IP addresses changing frequently, I recognize that this is true. The major reason I want to be able to create Identicons from IP addresses is to show when someone is posting under several names while using the same computer. To me, that is more important than letting people get the same Identicon no matter where they are commenting from.

    Lots of my commenters make up fake email addresses each time, anyhow. IP addresses would be more consistent than a person using ‘anon@anon.com’ one day and ‘anony@nope.com’ on another.

    It seems like it should be possible to change the basis of Identicon creation without changing how Gravatars are treated.

    The problem with doing that is that you need to determine whether or not a gravatar exists for a user’s email before displaying it, and gravatars don’t quite work that way. You’re not making any hits to the gravatar server, you’re just sticking an image tag into the page, and it’s the client browser that goes to the gravatar server to retrieve the image.

    Do you know how the WP_Identicon plugin worked?

    I am looking at the PHP code myself, but I am not a programmer and have not been able to spot anything that looks like it could be spliced into WordPress.

    The plugin is available here:

    http://downloads.wordpress.org/plugin/wp-identicon.zip

    The plugin works by putting the locally hosted identicon images as the default Gravatar image for each commenter. The builtin WordPress/Gravatar functions will not be able to do this. I may be a bit biased but why don’t you just continue using the plugin with Gravatar support if you want IP based identicons?

    It works by building the identicon locally and then adding the URL for it as a custom “default” avatar on the IMG pointing at gravatar.com. Which probably means that it’s slow as heck when there’s a lot of icons to be generated. But it likely only generates them one time then caches them locally.

    Also, it looks to me like the plugin would work fine with 2.6.1. Why not just use it? It has a filter on get_avatar, so you won’t even need to change any theme code, just continue using the same get_avatar call as you do already for normal gravatars, and this plugin overrides it.

    Otto42,

    I am trying to make the plugin and 2.6.1 work properly together.

    If I set Settings >> Discussion to ‘Don’t show Avatars’ then my comment sections don’t include any avatar images at all, even though I manually added the avatar code to my theme.

    If I set it to ‘Show Avatars’ what setting should I use at the bottom for ‘Default Avatar?’

    I have the plugin set to ‘My Theme Has Builtin WP2.5+ Avatars’ and ‘If a commenter has a gravatar use it, otherwise use Identicon’

    It seems that the plugin and WordPress 2.6.1 will work together. You just need to do the following:

    1) Install the plugin
    2) Set the discussion options in WordPress to: ‘Show Avatars’ and ‘Gravatar’ as ‘Default Avatar’
    3) Set the plugin to ‘My Theme Has Builtin WP2.5+ Avatars’ and ‘If a commenter has a gravatar use it, otherwise use Identicon’

    It may be necessary to manually add avatar code to your WordPress theme. I added it when I first installed the plugin and haven’t changed it since.

    For some reason, they don’t always render the first time a page is loaded (maybe because of the processing you mentioned). That may have thrown me off when I was testing configurations earlier.

    Thanks a lot for your help.

    Is that also an Identicon at http://wordpress.com/ ? I mean the one that appears on the upper left corner once logged in? It displays my gravatar right next to “Welcome back, <username>” line. Is this a plugin or a hack?

    Your WordPress.com icon is a Gravatar you picked yourself.

    Identicons are generated automatically.

    Originally, both Gravatars and Identicons were plugins for WordPress. They are both built into the latest versions.

    So it is possible to put that same feature in our blog to welcome members along with their gravatar?

    I didn’t know, until reading the comments above, that the geometric identicons had anything to do with IP addresses, but…

    my hope and question was, is it possible to use your own CUSTOM DESIGNED identicons for the comments on your own blog? Meaning, a little custom graphic to mark each comment that is left, beside it? And if so…..how would I make that happen, technically?? I would love to incorporate my own design into the look of my blog, overall.

    BUMP for my post above.
    Plymrocker

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Making Identicons from IP addresses, not email addresses’ is closed to new replies.
Skip to toolbar