in Line 528, inside the pollfield_perm() function, the permissions array is wrongly defined.

Instead of 'vote on polls' it should be 'vote on pollfields' as it is the latter which is used across the module.

CommentFileSizeAuthor
#4 pollfield.module.139085.patch435 bytesjaydub

Comments

Anonymous’s picture

Confirmed. Change Line 515 / 520 to this
/**
* Implementation of hook_perm().
*/
function pollfield_perm() {
return array('vote on pollfields', 'cancel own pollfield vote', 'inspect all pollfield votes');
}

dgraver’s picture

The 'inspect all votes' option does not seem to work for my site. Please go to http://www.whotobet.net and click on one of the games, and you will see that users cannot see other user's votes. Is there somewhere else other than the admin section that I need to set "Inspect all pollfield votes" ?

dgraver’s picture

OK...I think I figured out the problem.

/* original code

       if ($result = db_fetch_array(db_query("SELECT DISTINCT nid FROM {pollfield}"))) {
         $pollfields = array_filter((array) $result);
         if (in_array(arg(1), $pollfields)) {
end original code*/

This first line ($result) only returns one nid, and therefore when the 3rd line runs its 'if' statement, it only compares the node id to one other nid instead of all the nid's in pollfield table. I've updated it using the following code:

//start edit
       $query="SELECT DISTINCT nid FROM {pollfield}";
       $pollfield_array=array();
       $result=db_query($query);
       while ($new_nid = db_fetch_array($result)){
         $pollfield_array[] = $new_nid['nid'];
       }
      if (count($pollfield_array)>0){
//end edit

      $pollfields = array_filter((array) $pollfield_array);
      if (in_array(arg(1), $pollfields)) {

I've tested it a couple times, and it looks OK. Please let me know if this is alright.

jaydub’s picture

Status: Active » Needs review
StatusFileSize
new435 bytes

This patch is for the original bug report. The user reporting the other problem should submit that bug as a separate issue....

karens’s picture

Status: Needs review » Fixed

Both of these problems should now be fixed. Thanks for all the help!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.