nr_owners.module in Node registration 7
File
submodules/nr_owners/nr_owners.module
View source
<?php
function nr_owners_menu_alter(&$items) {
$item =& $items['node/%node/node_registration/settings'];
$item['access callback'] = 'nr_owners_nr_settings_page_access';
$item['access arguments'] = array(
1,
);
}
function nr_owners_nr_settings_page_access($node) {
if (node_registration_node_access($node, 'registration settings')) {
$settings = _node_registration_node_type_settings($node->type);
return user_access('administer node registration') || empty($settings->extra_nr_owners_no_settings_tab);
}
}
function nr_owners_form_node_registration_type_settings_alter(&$form, &$form_state) {
$registration_type = $form['#registration_type'];
$type = $registration_type->type;
$settings = _node_registration_node_type_settings($type);
$form['events']['extra_nr_owners_no_settings_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Disable settings tab on node page'),
'#default_value' => !empty($settings->extra_nr_owners_no_settings_tab),
'#description' => t('Access denies the settings tab for all people without Administer registration permission.'),
);
}
function nr_owners_node_registration_node_access($node, $op, $account, $reason) {
if (in_array($op, array(
'registration settings',
'administer',
))) {
if (_node_registration_node_type_enabled($node->type) && $account->uid == $node->uid) {
return TRUE;
}
}
}
function nr_owners_node_registration_access($registration, $op, $account, $reason) {
if (in_array($op, array(
'edit',
'update',
)) && $registration->node->uid == $account->uid) {
return TRUE;
}
}