function notifications_page_subscribe in Notifications 6.4
Same name and namespace in other branches
- 5 notifications.admin.inc \notifications_page_subscribe()
- 6 notifications.pages.inc \notifications_page_subscribe()
- 6.2 notifications.pages.inc \notifications_page_subscribe()
- 6.3 notifications.pages.inc \notifications_page_subscribe()
- 7 notifications.pages.inc \notifications_page_subscribe()
Menu callback add subscription
Presents confirmation page or not depending on confirm parameter
1 string reference to 'notifications_page_subscribe'
- notifications_menu in ./
notifications.module - Implementation of hook_menu().
File
- ./
notifications.pages.inc, line 81 - User pages for Notifications
Code
function notifications_page_subscribe($account, $type, $fields, $values, $send_interval = NULL, $send_method = NULL) {
// Build subscriptions object
$subscription = notifications_build_subscription(array(
'uid' => $account->uid,
'type' => $type,
'send_interval' => $send_interval,
'send_method' => $send_method,
));
$subscription
->add_field_args($fields, $values);
$subscription
->set_account($account);
// Check permission again for these parameters
if ($account->uid && notifications_page_check_access($account->uid) && notifications_user_allowed_subscription($account, $subscription)) {
if (notifications_page_check_confirmation()) {
// Subscribe, no confirmation
notifications_save_subscription($subscription);
drupal_set_message(t('Your subscription was activated.'));
drupal_goto();
}
else {
// Ask for confirmation
drupal_set_title(t('Confirm your subscription'));
return drupal_get_form('notifications_subscription_confirm_form', $subscription);
}
}
else {
drupal_set_message(t('Subscription type or parameters not allowed'), 'error');
drupal_goto();
}
drupal_access_denied();
}