Support » Plugin: Gravatar Signup Encouragement » [Plugin: Gravatar Signup Encouragement] Does not work with allow_url_fopen=0

Viewing 9 replies - 1 through 9 (of 9 total)
  • Ninja patch!

    --- gravatar-signup-encouragement.orig.php	2011-10-10 13:22:12.783839000 -0500
    +++ gravatar-signup-encouragement.php	2011-10-10 13:43:28.900355000 -0500
    @@ -512,6 +512,31 @@
    + * Get HTTP headers from a given URL
    + *
    + * @since 3.1
    + * @param string $url URL to get HTTP headers for
    + * @return array
    + */
    +function gravatar_signup_encouragement_get_headers( $url ) {
    +  if ( ini_get( 'allow_url_fopen' ) ) {
    +    return get_headers( $url );
    +  } else {
    +    $ch = curl_init( $url );
    +    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    +    curl_setopt( $ch, CURLOPT_HEADER, true );
    +    curl_setopt( $ch, CURLOPT_NOBODY, true );
    +    $content = curl_exec( $ch );
    +    curl_close( $ch );
    +    return array($content);
    +  }
      * Check if gravatar exists
      * @since 2.0
    @@ -520,7 +545,7 @@
     function gravatar_signup_encouragement_check_gravatar_existence( $email ) {
     	$fileUrl = "" . md5( strtolower( $email ) )."?s=2&d=404";
    -	$AgetHeaders = @get_headers( $fileUrl );
    +	$AgetHeaders = gravatar_signup_encouragement_get_headers( $fileUrl );
     	if ( ! preg_match( "|200|", $AgetHeaders[0] ) ) {
     		return false;
     	} else {
    Plugin Author Milan Dinić


    Thanks for this report and a patch.

    I actually thought about adding this since I got similar reports (for non existing gravatar it doesn’t report) and I created a test plugin but there wasn’t any feedback so I forgot about it.

    There is one thing that I would change from your patch. Instead of cURL I would use WordPress HTTP API which is the only right way to use this kind of stuff in WordPress.

    You may wondering why I didn’t use it instead of get_headers. Reason is that WordPress is much slower and here we need result very fast.

    So WordPress should be used as a fallback as in your example.

    I will add this but I need to test it some time and I think that it’s not crucial to have it fixed immediately (you already have temporary solution for yourself).

    does gravatar even work? everytime i try to change my picture or just log in.. i get nothing but problems from that service and hate my picture they give me. i honestly refuse to post on most wordpress sites that i see uses the service. I personally use an upload on my sites because if I am having this much trouble.. my customers and thier customers will be just as frustrated and probably mad at the stupid cartoon monsters plastered next to a serious post.. just something to think about.

    edited after post.. see, there is a perfect example of what i mean.. now i will leave this site.. THIS is NOT what i want my customers to feel like.. to make a post and have such a stupid 3 year old looking avatar next to work..

    Well, back to the original thread (as those who use this plugin like and use Gravatar on their blogs and aren’t seeking criticisms of it)…

    I think this is what is tripping me up too. I haven’t used the WordPress HTTP API before, and so I’ll use the cURL patch until there’s a patch to the plugin. I know cURL to work well and fast on my hosting server.

    Thanks jlencion!

    Hmmm, even after applying the patch, which should have worked, it’s still saying a registered user who definitely has a gravatar for their e-mail address doesn’t have one yet.

    In this case, the gravatar isn’t the primary e-mail address in the Gravatar account, but instead a secondary one. Might that make a difference?

    Plugin Author Milan Dinić


    This is finally added in version 3.1. Please report any issues.

    Still not working. My “Hmmm” remark above still applies.

    Plugin Author Milan Dinić


    I need more details, URL where it’s happening and email address. If you are concerned about sharing those information publicly, you can send them to me privately.

    I’ve decided to uninstall it. I don’t have the time to follow up on this right now. Sorry.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Gravatar Signup Encouragement] Does not work with allow_url_fopen=0’ is closed to new replies.