WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Making Identicons from IP addresses, not email addresses (14 posts)

  1. sindark
    Member
    Posted 5 years ago #

    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

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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...

  3. sindark
    Member
    Posted 5 years ago #

    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.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  5. sindark
    Member
    Posted 5 years ago #

    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

  6. scottsm
    Member
    Posted 5 years ago #

    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?

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  8. sindark
    Member
    Posted 5 years ago #

    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'

  9. sindark
    Member
    Posted 5 years ago #

    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.

  10. htan
    Member
    Posted 5 years ago #

    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?

  11. sindark
    Member
    Posted 5 years ago #

    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.

  12. htan
    Member
    Posted 5 years ago #

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

  13. Plymrocker
    Member
    Posted 4 years ago #

    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.

  14. Plymrocker
    Member
    Posted 4 years ago #

    BUMP for my post above.
    Plymrocker

Topic Closed

This topic has been closed to new replies.

About this Topic