Page 1 of 2

karma voting

Posted: Tue Oct 17, 2006 8:03 pm
by rx scabin
I have installed karma voting plugin in Serendipity 1.0. When I try to vote I get the following message "Your voting was invalid."

What am I doing wrong?

Re: karma voting

Posted: Wed Oct 18, 2006 10:38 am
by garvinhicking
Hi!

You must have javascript and cookies enabled to cast a vote. Do you have that?

Best regards,
Garvin

javascrit and cookies

Posted: Wed Oct 18, 2006 4:35 pm
by rx scabin
Yes, both are set.

Re: javascrit and cookies

Posted: Thu Oct 19, 2006 12:35 pm
by garvinhicking
Hi!

What'S the URL, then I could see if it works for me?

Best regards,
GArvin

The url

Posted: Thu Oct 19, 2006 3:48 pm
by rx scabin
http://stu.xopc29.org/serendipity/

By the way, I use Serendipity on 2 other blogs as well. :D No karma voting for them though. All are for my research into literacy.

Thank you.

Re: The url

Posted: Fri Oct 20, 2006 11:53 am
by garvinhicking
Hi!

Could you patch your serendipity_event_karma.php plugin file like this:

Search for:

Code: Select all

if (!isset($msg)) {
    $msg = '<div class="serendipity_karmaVoting serendipity_karmaError"><a id="karma_vote' . $this->karmaId . '"></a>' . PLUGIN_KARMA_INVALID . '</div>';
}
change that to:

Code: Select all

if (!isset($msg)) {
    $msg = '<div class="serendipity_karmaVoting serendipity_karmaError"><a id="karma_vote' . $this->karmaId . '">' . $this->karmaVote . '</a>' . PLUGIN_KARMA_INVALID . '</div>';
}
This should give an more detailed error message on what might be wrong. Which PHP version are you using?

This is what I get now

Posted: Fri Oct 27, 2006 10:23 pm
by rx scabin
Sorry it took me so long to get back.
I changed the serendipity_event_karma.php plugin file in the manner you said ( I believe). Prior to that I changed to an older version of the plugin which worked at my other Serendipity (0.9) blogs. That did not work although karma voting works great at those blogs.

The error message at the botom of the post where it allows one to karma vote is
invalid2 Your voting was invalid

Ii use the same version of php at all blogs. It is 4.4.x (latest stable release) and PHP 5.x

Thanks for all your help

Re: This is what I get now

Posted: Mon Oct 30, 2006 9:53 am
by garvinhicking
Hi!

No problem for me. :)

Okay, we're getting close. A DB query is not properly executed.

Please find this:

Code: Select all

                    // Voting takes place here.
                    $q = 'SELECT *
                            FROM ' . $serendipity['dbPrefix'] . 'entries AS e
                 LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'karma   AS k
                              ON e.id = k.entryid
                           WHERE e.id = ' . serendipity_db_escape_string($this->karmaId) . ' LIMIT 1';
                    $row = serendipity_db_query($q, true);
and change it to:

Code: Select all

                    // Voting takes place here.
                    $q = 'SELECT *
                            FROM ' . $serendipity['dbPrefix'] . 'entries AS e
                 LEFT OUTER JOIN ' . $serendipity['dbPrefix'] . 'karma   AS k
                              ON e.id = k.entryid
                           WHERE e.id = ' . serendipity_db_escape_string($this->karmaId) . ' LIMIT 1';
                    $row = serendipity_db_query($q, true);
                    die($q . " RETURNS: " . print_r($row, true) . "<br />\n");
This should return a SQL query when you cast a vote, and a return result. Can you tell me what gets displayed?

Regards,
Garvin

I did it

Posted: Mon Oct 30, 2006 6:31 pm
by rx scabin
This came up as the page:

SELECT * FROM serendipity_entries AS e LEFT OUTER JOIN serendipity_karma AS k ON e.id = k.entryid WHERE e.id = 58 LIMIT 1 RETURNS:

SELECT *
FROM serendipity_entries AS e
LEFT OUTER JOIN serendipity_karma AS k
ON e.id = k.entryid
WHERE e.id = 58 LIMIT 1

/ Table 'xopc29a_connect.serendipity_karma' doesn't exist


Thanks again

Re: I did it

Posted: Mon Oct 30, 2006 10:24 pm
by garvinhicking
Hi rx!

Ah, there we have the culprit. Your 'karma' table does not exist at all.

Which MySQL are you using? Try to uninstall the karma plugin and then install it again, this should try to rebuild the missing tables.

Regards,
Garvin

Reinstalled

Posted: Tue Oct 31, 2006 3:32 pm
by rx scabin
I still get the same error.

Re: Reinstalled

Posted: Tue Oct 31, 2006 3:37 pm
by garvinhicking
Hi!

Which MySQL version are you using?

Use phpMyAdmin to execute a query like this:

Code: Select all

CREATE TABLE serendipity_karma (
                        entryid int(11) default null,
                        points int(4) default null,
                        votes int(4) default null,
                        lastvote int(10) NULL,
                        visits int(11) default null
                    )
Best regards,
Garvin

MySQL

Posted: Tue Oct 31, 2006 3:42 pm
by rx scabin
The version is 4.1.21

Thank you for all your help.

Re: MySQL

Posted: Wed Nov 01, 2006 5:50 pm
by garvinhicking
Hi!

And what happens when you execute the querY?

Regards,
Garvin

Here is what I get for Query.

Posted: Wed Nov 01, 2006 6:59 pm
by rx scabin
Error

SQL query:

CREATE TABLE serendipity_karma(
entryid int( 11 ) default NULL ,
points int( 4 ) default NULL ,
votes int( 4 ) default NULL ,
lastvote int( 10 ) NULL ,
visits int( 11 ) default NULL
)

MySQL said: Documentation
#1142 - CREATE command denied to user 'xopc29a_stu2'@'localhost' for table 'serendipity_karma'