You are here

function simplenews_form_user_profile_form_alter in Simplenews 7.2

Same name and namespace in other branches
  1. 7 simplenews.module \simplenews_form_user_profile_form_alter()

Implements hook_form_FORM_ID_alter().

Add simplenews subscription management form to account 'Newsletters'

File

./simplenews.module, line 1210
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_form_user_profile_form_alter(&$form, &$form_state) {
  if ($form['#user_category'] == 'simplenews') {
    $subscription = simplenews_subscriber_load_by_mail($form['#user']->mail);
    module_load_include('inc', 'simplenews', 'includes/simplenews.subscription');
    simplenews_subscriptions_account_form($form, $form_state, $subscription);
    $form['subscriptions']['#title'] = t('Newsletter subscriptions');
    unset($form['update'], $form['subscriptions']['mail']);
  }
}