function notifications_anonymous_page_subscribe in Notifications 6.4
Menu callback add subscription
As it needs an address every time, no need for signed pages
1 string reference to 'notifications_anonymous_page_subscribe'
- notifications_anonymous_menu in notifications_anonymous/
notifications_anonymous.module - Implementation of hook_menu()
File
- notifications_anonymous/
notifications_anonymous.pages.inc, line 15 - Notifications for anonymous users
Code
function notifications_anonymous_page_subscribe($type, $fields, $values, $send_interval = NULL, $send_method = NULL) {
$account = drupal_anonymous_user();
// Build subscriptions object
$subscription = Notifications_Subscription::build((object) array(
'uid' => $account->uid,
'type' => $type,
'send_interval' => $send_interval,
'send_method' => $send_method,
));
$subscription
->set_account($account);
$subscription
->add_field_args($fields, $values);
// Check permissions and if allowed, ask for confirmation
if (notifications_user_allowed_subscription($account, $subscription)) {
drupal_set_title(t('Confirm your subscription'));
return drupal_get_form('notifications_anonymous_subscription_confirm_form', $subscription);
}
else {
drupal_set_message(t('Subscription type or parameters not allowed'), 'error');
drupal_goto();
}
drupal_access_denied();
}