function notifications_forum_user in Forum notifications 6
Implements hook_user().
File
- ./
notifications_forum.module, line 95
Code
function notifications_forum_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'register':
$forums = array();
foreach (forum_get_forums() as $forum) {
$forums[$forum->tid] = $forum->name;
}
if (empty($forums)) {
return;
}
$form['notifications_forum'] = array(
'#type' => 'fieldset',
'#title' => t('Notifications'),
'#tree' => TRUE,
);
$form['notifications_forum']['forums'] = array(
'#type' => 'checkboxes',
'#title' => t('Forums'),
'#options' => $forums,
'#description' => t('The forums you would like to subscribe to.'),
);
$form['notifications_forum']['send_method'] = array(
'#parents' => array(
'messaging_default',
),
'#type' => 'select',
'#title' => t('Default send method'),
'#options' => messaging_method_list(),
'#default' => messaging_method_default(),
);
$form['notifications_forum']['send_interval'] = array(
'#parents' => array(
'notifications_send_interval',
),
'#type' => 'select',
'#title' => t('Default send interval'),
'#options' => notifications_send_intervals(),
'#default' => variable_get('notifications_default_send_interval', 0),
);
return $form;
case 'insert':
$forums = $edit['notifications_forum']['forums'];
unset($edit['notifications_forum']);
// subscribe to the forums
foreach ($forums as $tid) {
if ($tid > 0) {
_notifications_forum_subscribe_to_forum($account, $tid, array(
'send_method' => $edit['messaging_default'],
'send_interval' => $edit['notifications_send_interval'],
));
}
}
break;
}
}