This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Votes and Flags don't work
#1

Clicking on the buttons to vote the comments up or down won't work, flagging as spam won't work too, but the reply button and everything else seems to be working fine.
The javascript message won't show up, and these functions don't work even if I disable the message, and the page goes to the top when buttons get clicked.
Reply
#2

The vote and flag buttons use jQuery. Your page likely has something which is interfering with it. If you post a link to your page I could take a look.

Have you completed the interview?
Reply
#3

Sorry, I'm testing on local server. (And now I'm posting on mobile ^^')
But, yes, I'm using jQuery for Dynamics Drive Smooth Menu, and I'm using jQuery I downloaded from the Google page
Commentics isn't the first script that didn't work, probably because of the same thing, now that I'm thinking...
Console gives an error:
"Uncaught type error: cannot write property 'classname' of 'undefined'." (Or something like that. ^^')
Thank you for your support! =D
Reply
#4

Fixed, downloaded jQuery 1.7.2 (same version commentics was using), replaced the version I was using, and removed the code that loaded jQuery from templates/comments.php.
Thank you. ^^
Reply
#5

Hello

I need a little help. I want to change tables order, (right to left)
and why when I use in a web page with directory address like:http://kabulit.com/art/290 the vote an flag not work. but if I change the address to http://kabulit.com/view.php?entryID=290 it works fine. it is open to try it.
And thanks for your good script.
Reply
#6

Hi,

What exactly do you mean by "tables"?

If you mean the text inside the comment boxes, you would open the stylesheet (/comments/css/stylesheet.css) and add the line below:

.cmtx_comment_text {
font-family: helvetica;
font-size: 0.8em;
direction: rtl;
}

Have you completed the interview?
Reply
#7

At the moment, I'm not sure why the vote and flag features are not working when your URL is re-written.

I'll look into it and let you know if I find a solution.

Have you completed the interview?
Reply
#8

Thanks for your answer. I think when I user re-write, the link to vote/flag gets change from url:"comments/vote.php?type=down", to to plus this /art/ so then it willl not work.

see here: url:"http://kabulit.com/art/comments/vote.php?type=down",
but my link shloud be like:url:"http://kabulit.com/comments/vote.php?type=down",

Thanks for your help
Reply
#9

Hi,

You're right. It adds /art/ inside the URL.

I've been testing it in Firebug. I think I triggered a '500 Internal Server Error'. Can you check your server's error log to see the details.

Also, in /comments/includes/template/comments.php, can you replace this:

PHP Code:
<?php if ($cmtx_settings->show_like || $cmtx_settings->show_dislike || $cmtx_settings->show_flag) { ?>
<script type="text/javascript">
// <![CDATA[
if (typeof jQuery == "undefined") {
document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></scr" + "ipt>");
}
// ]]>
</script>
<?php } ?>

<?php if ($cmtx_settings->show_like || $cmtx_settings->show_dislike) { ?>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function() {
jQuery(".cmtx_vote").click(function()
{
var id = $(this).attr("id");
var name = $(this).attr("name");
var dataString = 'id='+ id ;
var parent = $(this);

if (name == 'up') {
jQuery.ajax({
type: "POST",
url: "<?php echo $cmtx_path . "vote.php?type=up"?>",
data: dataString,
cache: false,

success: function(html) {
parent.html(html);
}
});
} else {
jQuery.ajax({
type: "POST",
url: "<?php echo $cmtx_path . "vote.php?type=down"?>",
data: dataString,
cache: false,

success: function(html) {
parent.html(html);
}
});
}
return false;
});
});
// ]]>
</script>
<?php } ?>

<?php if ($cmtx_settings->show_flag) { ?>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function() {
jQuery(".cmtx_flag").click(function()
{
var id = $(this).attr("id");
var name = $(this).attr("name");
var dataString = 'id='+ id ;
var parent = $(this);
var proceed = true;

var answer = confirm('<?php echo cmtx_escape_js(CMTX_FLAG_CONFIRM) ?>');
if (!answer) { proceed = false; }

if (proceed) {
var text = prompt('<?php echo cmtx_escape_js(CMTX_FLAG_REASON) ?>','');
if (text == null) {
proceed = false;
}
}

if (name == 'flag' && proceed) {
jQuery.ajax({
type: "POST",
url: "<?php echo $cmtx_path . "flag.php?reason="?>" + text,
data: dataString,
cache: false,

success: function(html) {
parent.html(html);
}
});
}
return false;
});
});
// ]]>
</script>
<?php } ?>

With this:

PHP Code:
<?php if ($cmtx_settings->show_like || $cmtx_settings->show_dislike || $cmtx_settings->show_flag) { ?>
<script type="text/javascript">
// <![CDATA[
if (typeof jQuery == "undefined") {
document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js\"></scr" + "ipt>");
}
// ]]>
</script>
<?php } ?>

<?php if ($cmtx_settings->show_like || $cmtx_settings->show_dislike) { ?>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function() {

jQuery(".cmtx_vote").click(function() {

var id = jQuery(this).attr("id");
var name = jQuery(this).attr("name");
var dataString = 'id=' + id;
var parent = jQuery(this);

if (name == 'up') {

jQuery.ajax({
type: "POST",
url: "<?php echo $cmtx_settings->url_to_comments_folder . "vote.php?type=up"?>",
data: dataString,
cache: false,

success: function(html) {
parent.html(html);
}

});

} else {

jQuery.ajax({
type: "POST",
url: "<?php echo $cmtx_settings->url_to_comments_folder . "vote.php?type=down"?>",
data: dataString,
cache: false,

success: function(html) {
parent.html(html);
}

});

}

return false;

});
});
// ]]>
</script>
<?php } ?>

<?php if ($cmtx_settings->show_flag) { ?>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function() {

jQuery(".cmtx_flag").click(function() {

var id = jQuery(this).attr("id");
var name = jQuery(this).attr("name");
var dataString = 'id=' + id;
var parent = jQuery(this);

var proceed = true;

if (proceed) {
var answer = confirm('<?php echo cmtx_escape_js(CMTX_FLAG_CONFIRM) ?>');
if (!answer) { proceed = false; }
}

if (proceed) {
var text = prompt('<?php echo cmtx_escape_js(CMTX_FLAG_REASON) ?>', '');
if (text == null) { proceed = false; }
}

if (name == 'flag' && proceed) {

jQuery.ajax({
type: "POST",
url: "<?php echo $cmtx_settings->url_to_comments_folder . "flag.php?reason="?>" + text,
data: dataString,
cache: false,

success: function(html) {
parent.html(html);
}

});

}

return false;

});
});
// ]]>
</script>
<?php } ?>

Have you completed the interview?
Reply
#10

Hello again, I fixed the problem.
in comments/includes/template/comments.php line 214, 225 and 266 put echo 'http://'.$_SERVER['SERVER_NAME'].'/'.

check example under
url: "<?php echo $cmtx_path . "vote.php?type=down"?>",
url: "<?php echo 'http://'.$_SERVER['SERVER_NAME'].'/'.$cmtx_path . "vote.php?type=down"?>",
I hope this help others too.
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
27-Mar-2013, 06:59 PM
Last Post by Koksi
22-Nov-2012, 03:19 PM
Last Post by Steven
03-May-2012, 12:22 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)