We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9585
    • 50 Posts
    I have a members section which people sign up through WebloginPE. Once signed up, the user becomes a member of the web user group ’member’ and can post comments using Jot.  I’ve installed the phx:gravatar snippet and call it in my template using [+phx:gravatar=`[+comment.custom.email+]`+] however it only ever shows the default gravatar jpg I created.

    Once the user is logged in then the only fields that are visible in the Add a comment section are ’Subject’ and ’Comment’. Does the ’Email’ address field have to be there as well in order for the gravatar to work? Obviously there seems to be something that hides the ’Email’ address field when posting comments if a web user is logged in.

    Any help much appreciated.

    Danny
      • 7231
      • 4,205 Posts
      I had the same bug. There is an error in the gravatar phx snippet. I changed it to:
      <?php
      // get gravater if available
      
      $size = 60;
      $rating = 'R';
      $default = "http://modxdeveloper.com/assets/images/gravatar_default_60.png"; // url to default image
      
      // build the gravatar URL
      $newvalue= "http://www.gravatar.com/avatar.php?gravatar_id=".md5(strtolower($output))."&default=".urlencode($default)."&size=".$size."&rating=".$rating;
      
      return $newvalue;
      ?>


      I did not want the default gravatar so I used a custom default.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 9585
        • 50 Posts
        Thanks, that seems to have worked. To anyone who is interested I was also trying figure out a way to allocate a gravatar according to user group, I managed to do it this way....

        [+comment.createdby:mo=`moderator`:then=`<img src="path to image here" alt="Administrator" />`:else=`
        <img src="[+comment.createdby:userinfo=`email`:gravatar+]" alt="gravatar" />`+]

        Only a whole day wasted trying to get this to work....definitely need a beer now