For each and every field I have there is a permission setting. It seems that pollfield thinks that all the fields are some kind of pollfields.

This serves no purpose, uglifies the already ladden permissions screen and leaves my stunnend.
What is going on here?

CommentFileSizeAuthor
pollfield perms wtf.png34.57 KBdddave

Comments

mario_prkos’s picture

/**
*hook permisions
*
*/
function pollfield_perm() {
    
   //get table
    $fields = content_fields();	
    foreach ($fields as $i => $key) {
	if ($fields[$i]['module']=='pollfield'){
	  $permission[]='view pollfield results '.$i;
        }
     }    
   return $permission;
}

Change perm hook in pollfield.module with this code it will solve you a probelm. Sorry if this make so much problem.
In my desire to put permission on every field I just forgot to filter permission just for pollfield module. People make mistake!
I will also put this in dev version.

dddave’s picture

I was merely stunned. Don't want to attack you personally. Hope you did not take it the wrong way. I tend to use loose language after some hours in front of the screen. ;)

Thx for the quick fix.

portulaca’s picture

Don't worry, you're not a real programmer until you get a WTF issue reported :D :D

mario_prkos’s picture

Good point portalca that is life of doing work :D. It is not problem. I just want that people have at least problem as is possible even it is in beta release. Keep testing and posting issues it can makes this module great.

dddave’s picture

Version: 6.x-1.8-beta1 » 6.x-1.x-dev
Status: Active » Fixed

This is fixed for weeks now....

Status: Fixed » Closed (fixed)

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

sun’s picture

Status: Closed (fixed) » Active

Additionally, the $permission variable is not initialized as an array:

/**
 * Implementation of hook_perm().
 */
function pollfield_perm() {

  //get table
  $fields = content_fields();
  foreach ($fields as $i => $key) {
    if ($fields[$i]['module']=='pollfield') {
      $permission[]='view pollfield results '. $i;
			$permission[]='admin pollfield '. $i;
    }
  }

  return $permission;
}

Thus, if no poll field exists yet, this throws a PHP notice about $permission being undefined and returns NULL instead of an array.

(Coming from #963134: PHP error on administrative protection form if Pollfield module is installed)

bryan kennedy’s picture

Status: Active » Fixed

Sun, I fixed up the hook_permission to define the array first. Thanks for catching that.

The original issue and the related comments are now fixed in the latest dev.

Status: Fixed » Closed (fixed)

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