Okay, about a dozen people have emailed me over the last few months to tell me my code is wrong. Which is true. The line in question is where I make the URL for the gravatar.
I do it thus:
gravatar_id=$md5.jpg&;r=$rating&;s=$size&;d=$url
The important thing being that the fields have an ampersand, followed by a semicolon. The API calls for just an ampersand. So my code is “wrong”, except that it works. If I use “correct” code:
gravatar_id=$md5.jpg&rating=$rating&size=$size&d=$url
It breaks. Wavatars show up, but Gravatars do not. Everyone shows up as a wavatar.
Other people report the opposite: My code breaks, the correct code works as it should. It’s pissing me off, because I don’t have the time or the patience to sort out this nonsense, which (I’m guessing) comes from differing versions of PHP. To really fix the problem, I have to figure out what PHP options or versions are causing the different behavior, check for them, and use the different versions of the URL based on those values. I could sink a lot of hours into a fishing expedition like that, and I just don’t have them right now.
Having said that, if anyone has a guess, please drop a comment.
LATER: Perhaps it’s not related to PHP versions. I found a case where leaving the “ratings” blank would cause my code to work, and filling it in would cause the correct code to work.
The Best of 2018
I called 2018 "The Year of Good News". Here is a list of the games I thought were interesting or worth talking about that year.
The Witch Watch
My first REAL published book, about a guy who comes back from the dead due to a misunderstanding.
Charging More for a Worse Product
No, game prices don't "need" to go up. That's not how supply and demand works. Instead, the publishers need to be smarter about where they spend their money.
Mass Effect Retrospective
A novel-sized analysis of the Mass Effect series that explains where it all went wrong. Spoiler: It was long before the ending.
Black Desert Online
This Korean title would be the greatest MMO ever made if not for the horrendous monetization system. And the embarrassing translation. And the terrible progression. And the developer's general apathy towards its western audience.
Whoops, I added a comment to the wrong post. Added again below for extra spamminess:
gravatar_id=$md5.jpg&rating=$rating&size=$size&d=$url
You'll have to put an extra semicolon (;) after each & in the above quoted “correct” code.
Otherwise you'll lose the semicolons as they're part of the code for the ampersand.
Try this?
gravatar_id=$md5.jpg&;rating=$rating&;size=$size&;d=$url
Disclaimer: I know nothing about gravatars, wavatars, wordpress or blogging.
EDIT: And the suggestion I made lost the important bits when I posted it…should be correct this time…I think.
How come in the first code snippet, the ampersands are showing as a single ampersand, and in the second, they are showing as XML-encoded ampersands? This may be related to your problem, or it may be entirely a display artifact. (Which is why I described the results in English instead of trying to type them; comment engines often have the same trouble.)
That is, in one snippet it’s x=1&y=2, and the other it’s x=1&y=2 . As literally appearing in HTML, it probably should be x=1&y=2. (And while the comments are displaying what I submit correctly, it’s leaking escaping levels when I edit the comment: & gets collapsed to &.)
As of this posting, you’re outputting “&;” which won’t work at all.
I did a few quick tests, and it looks like it is the rating field that may be giving you problems. If the rating field has an invalid rating value, the gravatar site will always go to the default. Right now your site is attempting to pass a blank rating (which is not a valid rating), so the result should be only wavatars show up.
However, the extra semi-colon in your broken version doesn’t send “rating”, it sends “;rating” which the gravatar site ignores. So that allows the gravatars to show up correctly, but since you also send “;default” the default value is also being ignored, so you do not get any wavatars.
My suggestion is to use the correct & and make sure you either fill in a valid rating or leave the rating field off.
Note that it is the browser that converts the & code to a single & so a correct url will just have the & in it. It is possible that some browsers treat the &; pattern as special (in an attempt to clean up poorly written html pages) and that may be resulting in inconsistent behavior across browsers.
I’m with Sord. You should always use the proper & (and not some evil corruption like &; or &;).
But the $rating you’re currently passing in is blank. So if you fix the code and then go to your wavatar options page in the dashboard and type in “PG” then it should start working properly again.
(I think one of the issues here is that with the current code the rating field defaults to blank, not to a valid rating. That probably ought to get fixed too.)
Also, as I specified in the patch you should technically be calling urlencode rather than passing the default URL in directly. The old gravatar site didn’t care since the URL you’re using didn’t contain any ampersands, but since it does contain slashes it is permitted for it to be parsed in a way that will produce a completely different result from what you want. I’m not sure if that’s actually the case (I’ve never tried not using urlencode, since I know it’s the right thing to do), so you might still be able to get away with not doing it. But you ought to :)
Yay, they’re alive again :D
They… Live… Again! :D
This is one of those situations where I have absolutely no knowledge of the specialty at hand, but I’m very glad many of you do.
At the risk of sounding like a bad Roddy Piper 80’s movie: They Live!!
My mischievous caltrop guy is back
meh…. this is why I love (and hate) coding
edit: I notice the captcha is gone now is that intentional?
It’s been gone for a while, Siliconscout. If you look down on the bottom of the page there is a button listing how many spam comments he has had that will explain it all.
Gotta say, I love this Wavatar thing. It will stop the whole “My avatar’s better” war that occurs on some blogs.