WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Like
Javascript Error (2 posts)

  1. mika89
    Member
    Posted 9 months ago #

    Hi everyone,

    I have a problem with the plugin: when I click the like button, the post is liked, and the "like" become "unlike". But when I click the unlike button without refreshing, the script doesn't work anymore: the button doesn't turn to "like", it's still "unlike". And when I use my webdev tools I figure out a JS error:

    Uncaught ReferenceError: bp_like_terms_like_message is not defined

    Does everyone get this error ?

    https://wordpress.org/plugins/buddypress-like/

  2. roy191991
    Member
    Posted 3 months ago #

    function bp_like(){jQuery(".like, .unlike, .like_blogpost, .unlike_blogpost").click(function(){var e=jQuery(this).attr("class"),t=jQuery(this).attr("id");jQuery(this).addClass("loading");jQuery.post(ajaxurl,{action:"activity_like",cookie:encodeURIComponent(document.cookie),type:e,id:t},function(n){jQuery("#"+t).fadeOut(50,function(){jQuery(this).html(n).removeClass("loading").fadeIn(50)});var r,i;if(e==="button like"){r=t.replace("like","unlike");jQuery("#"+t).removeClass("like").addClass("unlike").attr("title",bp_like_terms_unlike_message).attr("id",r)}else if(e==="acomment-reply bp-primary-action like"){r=t.replace("like","unlike");jQuery("#"+t).removeClass("like").addClass("unlike").attr("title",bp_like_terms_unlike_message).attr("id",r)}else if(e==="button like_blogpost"){r=t.replace("like","unlike");jQuery("#"+t).removeClass("like_blogpost").addClass("unlike_blogpost").attr("title",bp_like_terms_unlike_message).attr("id",r)}else if(e==="button unlike_blogpost"){r=t.replace("unlike","like");jQuery("#"+t).removeClass("unlike_blogpost").addClass("like_blogpost").attr("title",bp_like_terms_unlike_message).attr("id",r)}else if(e==="acomment-reply bp-primary-action unlike"){r=t.replace("unlike","like");jQuery("#"+t).removeClass("unlike").addClass("like").attr("title",bp_like_terms_like_message).attr("id",r)}else{r=t.replace("unlike","like");jQuery("#"+t).removeClass("unlike").addClass("like").attr("title",bp_like_terms_like_message).attr("id",r)}});return false})}jQuery(document).ready(bp_like);jQuery(document).ajaxComplete(bp_like);

    $( "#dialog" ).dialog({ autoOpen: false });
    $( "#opener" ).click(function() {
    $( "#dialog" ).dialog( "open" );
    });

Reply

You must log in to post.

About this Plugin

About this Topic