I am developing a website for a sports club I am involved with (voluntary project for 160 kids ranging from 9 years old up to 17).

I have created a number of roles. For exampleTeam Captains can add match reports. Managers can add fixture information etc. The Club Secretary can add news items for the organisation etc.

I have done this by creating new nodes based on the "Story" node and renaming them etc.

As the main site administrator I can go in and change or modify or correct anyone else's content. However, it is too time consuming for me to do this.

So I want the Club Secretary to be able to modify anyone's content as well as his own, without being able to do other things that I can do as the site administrator (I don't want him to be able to mess things up such as static pages etc).

I tried to implement this by giving him privileges such as able to "administer nodes". However when testing this I get an error message which comes up as "Terminated request because of suspicious input data." because he has been able to click on the "page" node type content and try to modify it.

So what is the best way to allow him to edit all content apart from static pages I made with the page module?

I am using version 4.6.3

Any help would be greatly appreciated thank you.

Comments

dumbo12’s picture

If you are using the Taxonomy then you can use the "Taxonomy Access Control". It is really simple to use and works well. But read carefully the README files before. This make the using easy.

May you can also create a new role for this user and give hin on Administration->access->node-Modul the administration rights.
Have not test it. Just thought about it.

Hope this help you.

Steady’s picture

Hi tsedeke,

There seem to be a lot of issues with the module you mention.

Also, it means installing a new module. I'm still a beginner and would prefer to avoid this at this stage if possible.

Is there not a simpler way to do what I ask?

Anyone please help.

mikevk’s picture

If you want the Club Secretary to be able to edit all nodes of type "story", you can hack the story module.

Figure out his user ID by going to his profile and noting the ID in the address bar. Let's say it's 42. Then in story.module, after these lines:

function story_access($op, $node) {
  global $user;

... add this:

if ((42 == $user->uid) && ('update' == $op)) {
  return true;
}
merlinofchaos’s picture

If you're going to hack the story module, you may as well at least add a permission, which turns out to be very easy to do.

Look for the function story_perm() and add a string, say, 'edit stories'.

Then instead of (42 == $user->uid) above, put in user_access('edit stories')

-- Merlin

[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]

-- Merlin

[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

Steady’s picture

Thank you for the suggestions mikevk and merlinofchaos.

Unfortunately I know next to no php. Could you please clarify the code changes exactly. The two replies say different things and I'm not sure if I'm meant to incorporate both into the modified code.

I do know how to change the code in the module (I did it before to create new ones based on the story module) but it was just find and replace stuff.

Please help as it seems like it is the answer I need. Thanks.

sangamreddi’s picture

just edit the story module with these

Replace hook_prem with this

function story_perm() {
return array('create stories', 'edit own stories', 'edit stories');
}

Add this code after line 43

if ((user_access('edit stories')) && ('update' == $op)) {
return true;
}

Now U'll see new permissions in the access control with edit stories.

Sunny
www.gleez.com

pgscholt’s picture

I'm trying to do the same thing as the original poster, except with the page module, but it doesn't work. Is there something I'm missing?

You'd think that giving the user the ability to administrate nodes under access control would do the trick, but no.

Please help!

pgscholt’s picture

Based on what's been posted here, the following code should work, if the would-be administrator's uid is in fact 2, no?

/**
 * Implementation of hook_access().
 */
function page_access($op, $node) {
  global $user;
  
  if (2 == $user->uid) {
    return TRUE;
  }
  if ($op == 'create') {
    return user_access('create pages');
  }
  if ($op == 'update' || $op == 'delete') {
    if (user_access('edit own pages') && ($user->uid == $node->uid)) {
      return TRUE;
    }
  }
}
catch’s picture

I've just done this.

Easiest way is to make a role, then go to permissions and give it admin rights for the taxonomy module. Add the user to that and they'll be able to edit other nodes.