function simplenews_subscription_manager_form in Simplenews 6
Same name and namespace in other branches
- 5 simplenews.module \simplenews_subscription_manager_form()
Menu callback: Generates the subscription form for users.
See also
simplenews_subscription_manager_form_validate()
simplenews_subscription_manager_form_submit()
1 call to simplenews_subscription_manager_form()
- simplenews_admin_users_form in ./
simplenews.subscription.inc - Menu callback: handle the edit subscription page and a subscription page for anonymous users.
1 string reference to 'simplenews_subscription_manager_form'
- simplenews_menu in ./
simplenews.module - Implementation of hook_menu().
File
- ./
simplenews.subscription.inc, line 16 - (Un)subscription and (un)subscription confirmation
Code
function simplenews_subscription_manager_form(&$form_state, $snid = NULL) {
global $user;
if (isset($snid)) {
$account = new stdClass();
$account->snid = $snid;
$subscription = simplenews_get_subscription($account);
}
else {
$subscription = simplenews_get_subscription($user);
}
// If non-admin is trying to edit someone else's subscription, access denied.
if ($user->uid && $user->uid != $subscription->uid && !user_access('administer simplenews subscriptions')) {
drupal_access_denied();
return;
}
$form = _simplenews_subscription_manager_form($subscription);
$form['#validate'][] = 'simplenews_subscription_manager_form_validate';
$form['#submit'][] = 'simplenews_subscription_manager_form_submit';
$form['#redirect'] = '';
//Return to home page after (un)subscribe
return $form;
}