Hi, I have a support request which I think is very similar to the one entitled "Only the admin can use it" but that one doesn't seem to answer my question.

I have created a role called "helper". Is there a way for me to give the helper role the ability to create Events with Signups? As the administrator I get the Signup settings at the bottom of the Events creation page but I can't seem to figure out how to allow the "helper" role to get these settings unless I give it the "administer all signups" permission. I would prefer not to give this permission since I would like the helper role to only be able administer the events and signups that they create but not anyone else's.

This is what I have got installed

drupal-5.7
Event 5.x-1.0
Signup 5.x-2.4
Views 5.x-1.6

Many Thanks!!!

CommentFileSizeAuthor
#15 243051_signup_settings_fieldset_bug.patch1.93 KBdww

Comments

alt_pc’s picture

Hello! I think I might have some more information. The signup settings do appear, but only after the "helper" user creates the event and then goes back into it and edits it. I don't know if that is normal behavior for this module. It seems to work great otherwise! Thanks!

dww’s picture

Status: Active » Fixed

See point #5 in the INSTALL.txt file.

Go to admin/content/types/event on your site.
Scroll to the bottom and look for the "Signup options:" setting
Select the "Enabled (on by default)" radio button.

alt_pc’s picture

Thanks for the response! I checked that setting and found that I had already set it to enabled. So there doesn't seem to be a difference either way.

MedicSean37’s picture

I have the same exact problem. My content type has enable signup on too. It would be create to set the signup settings when creating the node/event.

dww’s picture

Category: support » bug
Status: Fixed » Active

Well, seems like this isn't "fixed" then. Perhaps it's a bug. Perhaps some will have time/ability to debug it. ;)

dww’s picture

#254192: Signup settings not shown when creating signed up enabled content marked duplicate.

I just looked at the code, and it's definitely a bug. Here's the problem:

function signup_alter_node_form($form_id, &$form) {
  ...
  // If the current user has the global 'administer all signups' permission
  // and signups are not explicitly disallowed, or if this node-type is
  // signup-enabled and the user has permission to administer signups for
  // their own content, add a fieldset for signup-related settings.
  if ( (($signup_type_default != 'disabled' || (!empty($node) && !empty($node->signup))) && user_access('administer all signups'))
       || (!empty($node) && $signup_type_default == 'enabled_on' && $node->uid == $user->uid && user_access('administer signups for own content')) ) {
    $form['signup'] = array(
      '#type' => 'fieldset',
      '#title' => t('Signup settings'),
      ...
    );
    ...
  }
}

If you read that (admittedly convoluted) if clause, you'll see that we never add the Signup settings fieldset to the node form if $node is empty (which is what happens at node/add/...) unless the current user has 'administer all signups'. So, someone just has to fix that logic to correctly handle the node/add case.

yrre7’s picture

Can someone help and fix this?
Thanks advance...

gracearoha’s picture

Hello?

Is there anyone there who knows how to fix this? I am hopeless with code, but am happy to test :)

gagarine’s picture

tracking

I have the same probleme. The user can't have the "helper" on creation but they have the option when they edit his node already created.

gagarine’s picture

Ok... i'm not sure is the good way... Now i just test if the node is empty... i'm not sure is completely safe, but it's work. Can we test if the node is in "added state"?
Sorry i can't create a patch because i'm not on my machine and i would like go to sleep so.. perhaps tomorow :)

// If the current user has the global 'administer all signups' permission
  // and signups are not explicitly disallowed, or if this node-type is
  // signup-enabled and the user has permission to administer signups for
  // their own content, add a fieldset for signup-related settings.
  if ( (($signup_type_default != 'disabled' || (!empty($node) && !empty($node->signup))) && user_access('administer all signups'))
       || (!empty($node) && $signup_type_default == 'enabled_on' && $node->uid == $user->uid && user_access('administer signups for own content')) || (empty($node) && user_access('administer signups for own content')) ) {
    $form['signup'] = array(
      '#type' => 'fieldset',
      '#title' => t('Signup settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 30,
    );
gagarine’s picture

Status: Active » Needs review
yrre7’s picture

It works fine with the above code change, but I think it kinda overrides the Signup disable settings for all the content types. Which means, you can't disable the signup for the content types you want....

chsiung’s picture

Priority: Normal » Minor

I noticed this problem as well and would like to track any solutions than come up.

chsiung’s picture

How about just adding the following check to the original code?

      (empty($node) && $signup_enabled && 
       user_access('administer signups for own content'))

So you have:

  if (user_access('administer all signups') ||
      (!empty($node) && $signup_enabled && $node->uid == $user->uid &&
       user_access('administer signups for own content')) ||
      (empty($node) && $signup_enabled && 
       user_access('administer signups for own content'))  ) {

I think the ($signup_type_default != 'disabled') check in comment 10 doesn't check that signup is enabled for the type and doesn't check that user has the privilege.

dww’s picture

Assigned: Unassigned » dww
Priority: Minor » Normal
StatusFileSize
new1.93 KB

Ok, sorry, everyone's confused in here, and it's all my fault. That if clause is way too complicated in the first place, which is why everyone's having so much trouble with this. Furthermore, it occurs to me and starbow (sitting right next to me), that the logic was wrong for another reason: whether or not you have administer all vs. administer own perms shouldn't change the behavior in terms of node types that allow signups. If the site admin says that a given node type (foo) should allow signups (but doesn't have them enabled by default), and I can administer signups for my own content, and I can create foo nodes, I should still get the fieldset to signup-enable any particular foo node I create...

So, here's a patch that should hopefully make all the logic much more clear by splitting apart the giant if into some separate, easier-to-grok variables, and then the logic becomes very simple:

  if ($signups_possible && ($admin_all || $admin_own)) {

See attached patch. I tested this a bunch and I think it's good, but other eyes are welcome before I commit. ;)

dww’s picture

Status: Needs review » Fixed

Starbow tested this and couldn't break it, so I just committed to HEAD. Yay. ;)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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