Great module, just downloaded it and tested it out tonight!

I went to write a hook_update to configure this module's permissions on my live server the same way I'd set them up on my localhost. When I did, I found that because there's whitespace at the start of each 'publish ___' permission, but not the 'unpublish ___' permissions, my hook_update properly enabled the permissions checkboxes for any unpublish perm, but ignored the publish ones.

<?php
$perms = array(
    '  publish *all* content',
    'unpublish *all* content',
  );
?>

Should be

<?php
$perms = array(
    'publish *all* content',
    'unpublish *all* content',
  );
?>

without the leading whitespace so that $ret[] = update_sql("UPDATE {permission} SET perm = CONCAT(perm, ', publish *all* content, unpublish *all* content') WHERE rid ="3"; will match both of the strings, and not just the second one. ;)

CommentFileSizeAuthor
#3 publishcontent_extraspaces.patch2.81 KBsyakely

Comments

syakely’s picture

/**
* Implementation of hook_perm().
*
* @note: the 2 extra spaces is a hack: Drupal 5-6 user permissions page set
* 'publish *all* content' auto-magically when 'unpublish *all* content'
* is set.
*/

SO, what was happening without the two extra spaces, is publish all content would activate, when a user choose unpublish all content.

syakely’s picture

After many many different attempts, the only way I was able to get it to work with out spaces was to change the word publish to publishing. SO, 'publish *all* content' to 'publishing *all* content'. I left unpublish alone, but added 'any' to mimic core node permission display.

syakely’s picture

StatusFileSize
new2.81 KB

A patch for changing all ' publish *' to 'publishing *' and adding 'any' to the permissions that apply, to mimic core node permission display.

YK85’s picture

Status: Active » Needs review

subscribing

aaronbauman’s picture

Status: Needs review » Closed (duplicate)
aaronbauman’s picture

see also http://drupal.org/cvs?commit=373960
- "update "*all*" to match drupal convention "any""
- added "any" to individual node_type permissions