function og_manage_form in Organic groups 5
Same name and namespace in other branches
- 5.8 og.module \og_manage_form()
- 5.2 og.module \og_manage_form()
- 5.3 og.module \og_manage_form()
- 5.7 og.module \og_manage_form()
- 6.2 og.pages.inc \og_manage_form()
- 6 og.module \og_manage_form()
File
- ./
og.module, line 363
Code
function og_manage_form($group) {
global $user;
// avoid double messages on POST
if (!$_POST) {
// group manager can't leave
if ($group->og_selective == OG_CLOSED) {
drupal_set_message(t('You may not leave this group because it is a %closed group. You should request removal from a group administrator.', array(
'%closed' => t('closed'),
)));
}
elseif ($group->uid == $user->uid) {
drupal_set_message(t('You may not leave this group because you are its owner. A site administrator can assign ownership to another user and then you may leave.'));
}
else {
$links[] = l(t('Leave this group'), "og/unsubscribe/{$group->nid}");
$form['unsubscribe'] = array(
'#type' => 'markup',
'#value' => theme('item_list', $links),
);
}
}
switch ($user->og_email) {
// og_email can be NULL when you enable og on an existing site.
case NULL:
case OG_NOTIFICATION_SELECTIVE:
$form['mail_type'] = array(
'#type' => 'radios',
'#title' => t('Email notification'),
'#default_value' => $user->og_groups[$group->nid]['mail_type'],
'#options' => array(
1 => t('enabled'),
0 => t('disabled'),
),
'#description' => t('Do you want to receive an email each time a message is posted to this group?'),
);
$submit = TRUE;
break;
case OG_NOTIFICATION_ALWAYS:
$form['mail_type'] = array(
'#type' => 'item',
'#title' => t('Email notification'),
'#value' => t('Your <a href="!prof">personal profile</a> is configured to: <em>Always receive email notifications</em>.', array(
'!prof' => url("user/{$user->uid}/edit"),
)),
);
break;
case OG_NOTIFICATION_NEVER:
$form['mail_type'] = array(
'#type' => 'item',
'#title' => t('Email notification'),
'#value' => t('Your <a href="!prof">personal profile</a> is configured to: <em>Never receive email notifications</em>.', array(
'!prof' => url("user/{$user->uid}/edit"),
)),
);
break;
}
if ($submit) {
$form['op'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
}
$form['gid'] = array(
'#type' => 'value',
'#value' => $group->nid,
);
return $form;
}