karma voting

Found a bug? Tell us!!
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

karma voting

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: karma voting

Post by garvinhicking »

Hi!

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

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

javascrit and cookies

Post by rx scabin »

Yes, both are set.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: javascrit and cookies

Post by garvinhicking »

Hi!

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

Best regards,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

The url

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: The url

Post 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?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

This is what I get now

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: This is what I get now

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

I did it

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: I did it

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

Reinstalled

Post by rx scabin »

I still get the same error.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Reinstalled

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

MySQL

Post by rx scabin »

The version is 4.1.21

Thank you for all your help.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: MySQL

Post by garvinhicking »

Hi!

And what happens when you execute the querY?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rx scabin
Regular
Posts: 18
Joined: Tue Oct 17, 2006 7:58 pm

Here is what I get for Query.

Post 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'
Post Reply