function og_notifications_form_alter in Organic groups 5.8
Same name and namespace in other branches
- 5 og_notifications/og_notifications.module \og_notifications_form_alter()
- 5.3 og_notifications/og_notifications.module \og_notifications_form_alter()
- 5.7 og_notifications/og_notifications.module \og_notifications_form_alter()
- 6.2 modules/og_notifications/og_notifications.module \og_notifications_form_alter()
- 6 modules/og_notifications/og_notifications.module \og_notifications_form_alter()
Implementation of hook_form_alter().
File
- og_notifications/
og_notifications.module, line 86 - Provide notifications and messaging support for organic groups.
Code
function og_notifications_form_alter($form_id, &$form) {
switch ($form_id) {
case 'notifications_content_settings_form':
$form['group'] = array(
'#type' => 'fieldset',
'#title' => t('Group subscriptions'),
'#collapsible' => TRUE,
'#weight' => 0,
);
// General content settings
$select = array();
$nodetypes = node_get_types();
$ogtypes = og_get_types('group_post');
foreach ($ogtypes as $ntype) {
$select[$ntype] = $nodetypes[$ntype]->name;
}
$form['group']['og_notifications_content_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed content types'),
'#default_value' => variable_get('og_notifications_content_types', array()),
'#options' => $select,
'#description' => t('Select specific content types which should be <em>allowed</em> for subscriptions to <em>group + content type</em>.'),
'#multiple' => TRUE,
);
break;
case 'user_edit':
// Insert autosubscribe option into the messaging section of the user edit
// form.
// user_edit is, oddly enough, also the form_id for forms in other
// sub-tabs such as those added by the profile module.
if (!arg(3)) {
$account = $form['_account']['#value'];
$form['messaging']['og_notifications_autosubscribe'] = array(
'#type' => 'checkbox',
'#title' => t('Automatically enable notifications for any groups that I join.'),
'#description' => t('Group notifications can also be <a href="!manage-url">customised</a> in greater detail if required.', array(
'!manage-url' => url('user/' . $account->uid . '/notifications/group'),
)),
'#default_value' => og_notifications_user_autosubscribe_get($account->uid),
);
}
break;
case 'og_admin_settings':
// Default autosubscription setting.
$form['og_settings']['notifications']['og_notifications_autosubscribe'] = array(
'#type' => 'checkbox',
'#title' => t('Autosubscribe users to any groups that they join.'),
'#description' => t('Automatically enable notifications by default. Users can override this via their account page. Changing this setting will only affect new users and those who have not overridden the system default.'),
'#default_value' => variable_get('og_notifications_autosubscribe', 1),
'#weight' => -5,
);
break;
}
}