Hi from here,
Thx for your reply and the help.
But i still can’t figure out till wich line i should go and replace the code. I am not that familiar with coding so i just tried to replace more an more down the “$.fn.kkstarratings.click = function(obj, stars)” line.
The rating still dosent work when not logged in. Down below is the rest of the js.js code, many you can tell tip wich line to go?
Thx
$.fn.kkstarratings.click = function(obj, stars)
{
alert("You must be registered to vote");
return false;
};
$.fn.kkstarratings.fetch = function(obj, stars, fallback_fuel, fallback_legend, is_fetch)
{
var postids = [];
$.each(obj, function(){
postids.push($(this).attr('data-id'));
});
$.ajax({
url: $.fn.kkstarratings.options.ajaxurl,
data: 'action='+$.fn.kkstarratings.options.func+'&id='+postids+'&stars='+stars+'&_wpnonce='+$.fn.kkstarratings.options.nonce,
type: "post",
dataType: "json",
beforeSend: function(){
$('.kksr-fuel', obj).animate({'width':'0%'}, $.fn.kkstarratings.options.fuelspeed);
if(stars)
{
$('.kksr-legend', obj).fadeOut('fast', function(){
$('.kksr-legend', obj).html('<span style="color: green">'+$.fn.kkstarratings.options.thankyou+'</span>');
}).fadeIn('slow');
}
},
success: function(response){
$.each(obj, function(){
var current = $(this),
current_id = current.attr('data-id');
if(response[current_id].success)
{
$.fn.kkstarratings.update(current, response[current_id].fuel+'%', response[current_id].legend, response[current_id].disable, is_fetch);
}
else
{
$.fn.kkstarratings.update(current, fallback_fuel, fallback_legend, false, is_fetch);
}
});
},
complete: function(){
},
error: function(e){
$('.kksr-legend', obj).fadeOut('fast', function(){
$('.kksr-legend', obj).html('<span style="color: red">'+$.fn.kkstarratings.options.error_msg+'</span>');
}).fadeIn('slow', function(){
$.fn.kkstarratings.update(obj, fallback_fuel, fallback_legend, false, is_fetch);
});
}
});
};
$.fn.kkstarratings.options = {
ajaxurl : bhittani_plugin_kksr_js.ajaxurl,
func : bhittani_plugin_kksr_js.func,
nonce : bhittani_plugin_kksr_js.nonce,
grs : bhittani_plugin_kksr_js.grs,
tooltip : bhittani_plugin_kksr_js.tooltip,
tooltips : bhittani_plugin_kksr_js.tooltips,
msg : bhittani_plugin_kksr_js.msg,
fuelspeed : bhittani_plugin_kksr_js.fuelspeed,
thankyou : bhittani_plugin_kksr_js.thankyou,
error_msg : bhittani_plugin_kksr_js.error_msg
};
})(jQuery, window, document);
jQuery(document).ready( function($){
$('.kk-star-ratings').kkstarratings();
});