| 1 |
<?php |
<?php |
| 2 |
// $Id: signup.module,v 1.133 2008/08/01 04:16:06 dww Exp $ |
// $Id: signup.module,v 1.134 2008/08/01 04:32:45 dww Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @defgroup signup_core Core drupal hooks |
* @defgroup signup_core Core drupal hooks |
| 421 |
|
|
| 422 |
$signup_type_default = variable_get('signup_node_default_state_'. $form['type']['#value'], 'disabled'); |
$signup_type_default = variable_get('signup_node_default_state_'. $form['type']['#value'], 'disabled'); |
| 423 |
|
|
| 424 |
// If the current user has the global 'administer all signups' permission |
// If signups are possible, and the current user either has the global |
| 425 |
// and signups are not explicitly disallowed, or if this node-type is |
// 'administer all signups' permission or has the 'administer signups |
| 426 |
// signup-enabled and the user has permission to administer signups for |
// for own content' permission and is creating new content or editing |
| 427 |
// their own content, add a fieldset for signup-related settings. |
// their own content, add a fieldset for signup-related settings. |
| 428 |
if ( (($signup_type_default != 'disabled' || (!empty($node) && !empty($node->signup))) && user_access('administer all signups')) |
|
| 429 |
|| (!empty($node) && $signup_type_default == 'enabled_on' && $node->uid == $user->uid && user_access('administer signups for own content')) ) { |
// Signups are possible if they're not explicitly disallowed for this |
| 430 |
|
// node type, or if this node is already signup-enabled (in case an |
| 431 |
|
// admin erroneously marks a node-type to disallow signups when there |
| 432 |
|
// are already nodes of that type with signups enabled). |
| 433 |
|
$signups_possible = $signup_type_default != 'disabled' || (!empty($node) && !empty($node->signup)); |
| 434 |
|
$admin_all = user_access('administer all signups'); |
| 435 |
|
$admin_own = user_access('administer signups for own content') && (empty($node) || ($node->uid == $user->uid)); |
| 436 |
|
if ($signups_possible && ($admin_all || $admin_own)) { |
| 437 |
$form['signup'] = array( |
$form['signup'] = array( |
| 438 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 439 |
'#title' => t('Signup settings'), |
'#title' => t('Signup settings'), |