Jason Flatt wrote:
On Wednesday 22 February 2006 12:34 pm, David Grant wrote:
  
How do I allow other users to edit content others have created?

For example, user1 creates a story. user1 can edit the story. How can I
give user2 rights to edit the story as well? There is a permission for
"edit own content" under stories but there is no "edit all content"
under stories. This seems like a severe limitation to me.

Thanks,
David
    

Modify the code for the story.module.

Specifically, edit line number 32, thusly:

  return array('create stories', 'edit own stories');

to something like:

  return array('create stories', 'edit own stories', 'edit any stories');

And add something like the following to the story_access() function:

  if ($op == 'update' || $op == 'delete') {
    if (user_access('edit any stories')) {
      return TRUE;
    }
  }

Disclaimer:  The above is UNTESTED code for the 4.6.5 version!

  
Thanks a lot!

My first question is, if I add a permission like this...what happens when I upgrade to 4.7 eventually? Any problems there?

I just checked out the story.module code... and it looks like the solution might be a bit simpler. Here it is:
if ($op == 'update' || $op == 'delete') {
    if (user_access('edit own stories') && ($user->uid == $node->uid)) {
      return TRUE;
    }
  }

I could just remove the && ($user->uid == $node->uid) which means that "edit own stories" permission now means "edit all stories" because there is no check whether or not they are the owner, just that they have the "edit own stories" permission. There are basically 3 people on the site in a "content creator" role. I want those people to be able to collaboratively edit content (ie. fix their typos, change wording, etc...) like on a wiki.

I could break up the logic...so that the ($user->uid == $node->uid) would be required to delete a story but not to edit it...

I dunno, I'm a bit of a n00b, does this make some sense? Can anyone poke any holes into this idea?

Thanks,
Dave