Voting System Problems (FIXED!)
Efreak15 —Thu, 02/28/2013 - 15:26
Currently the voting system for voting up/down on posts and logos is not working. The matter is being looked into, and hopefully a solution will appear soon.
UPDATE: The voting system should be working properly now. Thanks to gumanov for fixing the problem:)
- Efreak15's blog
- Log in or register to post comments or vote.
- +6
- 6 votes
Comments
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 01:26You posted this on Feb 28 and there is one positive vote
This is strange as voting has not been working
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 01:31How come this Logo has a vote
It was posted March 14 !!
http://www.userlogos.org/node/16686
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 01:38Deva's Logo here from March 12 has a vote
http://www.userlogos.org/node/16677
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 02:01Is this then a permissions issue rather than an API issue or what ?
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 02:39G
Was it you that managed to make a vote on the coinbase logo ?
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 06:39I notice on userscripts.org
That if one hovers the cursor over the down triangle on the voting widget one can see the link to the simple up/down/node/1
In all other logos that I can find this is not the case
Similarly sometimes the down goes to the link, sometimes the up
Also the down widget is coloured and on most Logos it is not
And the colour of the down switches on and off
So the widget itself seems to be semi working
But why only this logo and not others ?
Re: Voting System Problems
Submitted by gumanov on Fri, 03/15/2013 - 08:17Yes, I am the one who has been making votes on some logos.
They are test votes, I am working on the voting system.
It is not permissions related.
I tracked the issue down to a PHP function.
I am referring to the isset() function.
http://php.net/manual/en/function.isset.php
The simple up/down module will disable the up/down arrows under the following conditions:
1) User role is not set to allow voting
2) The user has already made a vote (the appropriate button will be disabled, while the opposite one stays enabled)
The issue is coming from option 2.. When the module verifies whether or not you have already made a vote, it uses the isset() function.
If a user has voted, the php variable "$vote" has a value of either -1 or +1, which means it is SET.
If the user has not voted, this variable is an empty database array, but it should still be considered SET.
For some reason it's having trouble verifying this variable, I'm not sure why.
If you HAVE VOTED, it works correctly, and allows you to change your vote, like it should. So isset($vote) returns TRUE.
But if you have NOT VOTED, it thinks that an empty array value in $vote refers to NOT SET, so isset($vote) is returning a FALSE value.
I don't know why...still investigating.
According to the PHP documentation, an empty array value SHOULD still be considered SET. The only time a variable should be considered NOT SET is if it has a value of NULL.
Re: Voting System Problems
Submitted by chiaroscuro on Fri, 03/15/2013 - 08:41Wow G thanks for your very detailed reply and the link
Sounds like you are getting close to resolving this issue
Congratulations :-)
Re: Voting System Problems
Submitted by gumanov on Fri, 03/15/2013 - 10:20FIXED.
The issue was a setting with MySQL.
When I upgraded servers I set up the site to use MySQLi instead of MySQL (the i stands for "improved" version")
Turns out that a database query to MySQL that results in no data returns the value "FALSE" for the isset() php function.
But for MySQLi (improved version) it will return a NULL value instead of FALSE.
I switched the site back to MySQL, problem solved.
Re: Voting System Problems
Submitted by Efreak15 on Fri, 03/15/2013 - 10:25Excellent job gumanov!
Re: Voting System Problems (FIXED!)
Submitted by Efreak15 on Fri, 03/15/2013 - 10:28Edited the post.
Re: Voting System Problems (FIXED!)
Submitted by chiaroscuro on Fri, 03/15/2013 - 10:50FIXED.
The issue was a setting with MySQL.
When I upgraded servers I set up the site to use MySQLi instead of MySQL (the i stands for "improved" version")
Turns out that a database query to MySQL that results in no data returns the value "FALSE" for the isset() php function.
But for MySQLi (improved version) it will return a NULL value instead of FALSE.
I switched the site back to MySQL, problem solved.
»
Good work G
Difficult problem to identify
This will make a big difference on the site
Vote +1 :-)
Re: Voting System Problems (FIXED!)
Submitted by chiaroscuro on Fri, 03/15/2013 - 10:54Hey it works !!!
Re: Voting System Problems (FIXED!)
Submitted by Deva on Fri, 03/15/2013 - 12:47Congrats gumanov, nice work!