19 Oct 2010

Blog4Umbraco and AJAX Comments

No Comments ASP.NET

Blog4Umbraco is probably one of the only ways to get a decent blog for Umbraco. I had a site which used some other JavaScript and lots of jQuery UI which I neeed to integrate, but as soon as I applied my MasterPage, the AJAX comment form broke. A quick search shows a few people have had this problem, so I want to post my fix. It’s almost embarrassingly simple

In /scripts/Blog4Umbraco/blog4umbraco.js, there’s a SetGravatar method, which makes what as far as I can tell is an invalid request. Instead of calling “/base/blog4umbraco/GetGravatarImage/” + s_email + “/80.aspx”, changing the path to “/base/blog4umbraco/GetGravatarImage/” + s_email + “.aspx” fix the problem in my case. Ie:

function SetGravatar(s_imgId, s_email, i_size){
    jQuery.get("/base/blog4umbraco/GetGravatarImage/" + s_email + ".aspx",
       function(data){
        var avatar = jQuery("#" + s_imgId );
        if(data != ""){
              var src = "http://www.gravatar.com/avatar/" + data + "?s=" + i_size;
              avatar.src(src).show();
          }else{
              avatar.hide();
          }
       });
}

Maybe it’ll work for you too.

Tags: , , , ,
written by
The author didn‘t add any Information to his profile yet.
No Responses to “Blog4Umbraco and AJAX Comments”

Leave a Reply