function notifications_page_unsubscribe_overview in Notifications 7
Same name and namespace in other branches
- 6.4 notifications.pages.inc \notifications_page_unsubscribe_overview()
Display unsubscribe options for this page
1 string reference to 'notifications_page_unsubscribe_overview'
- notifications_menu in ./
notifications.module - Implementation of hook_menu().
File
- ./
notifications.pages.inc, line 93 - User pages for Notifications
Code
function notifications_page_unsubscribe_overview() {
$account = $GLOBALS['user'];
notifications_include('destination.inc');
$output = '';
$send_methods = notifications_destination_anonymous_methods();
$subscriptions = 0;
// Provide information for user subscriptions if logged in
if ($user->uid) {
$subscriptions = db_result(db_query("SELECT COUNT(*) FROM {notifications_subscription} WHERE uid = %d", $user->uid));
if ($subscriptions) {
$output .= '<p>' . format_plural($subscriptions, 'There is one subscription for this user account.', 'There are @count subscriptions for this user account.') . '</p>';
$output .= '<p>' . t('You can:') . '<br />';
$options = array();
if (notifications_access_user($account, 'maintain')) {
$options[] = l(t('Administer your subscriptions'), "user/{$user->uid}/notifications");
$options[] = l(t('Temporarily disable all your subscriptions'), "user/{$user->uid}/notifications/update/disable");
}
$options[] = notifications_build_link('unsubscribe', array(
'title' => t('Cancel all your subscriptions'),
), 'user', $user, 'link');
$output .= theme('item_list', $options);
}
else {
$output .= '<p>' . t('There are no subscriptions for this user account') . '</p>';
if ($send_methods) {
$output .= '<p>' . t('However if you are still getting notifications from this site, enter your address below and you\'ll get a link to disable that address.') . '</p>';
}
}
}
if (!$subscriptions && $send_methods) {
// Present destination unsubscribe request form
$output .= drupal_get_form('notifications_destination_request_form', $account, $send_methods);
}
elseif (!$user->uid) {
// WTF? Someone is getting spam from here?
$output .= '<p>' . t('You may have an account on this site or someone may have created it for you.') . '</p>';
$output .= '<p>' . t('You can try to <a href="@user-login">log in</a>, request a <a href="@request-password">new password</a>, or contact the site administrator.', array(
'@user-login' => url('user/login'),
'@request-password' => url('user/password'),
)) . '</p>';
}
return $output;
}