You are here

function _simplenews_roles_form_alter_subscriptions in Simplenews Roles 6.2

Helper function for form_alter.

Removes newsletters from several subscriptions forms.

Parameters

$form: The 'subscriptions' array from the form.

2 calls to _simplenews_roles_form_alter_subscriptions()
simplenews_roles_form_simplenews_subscription_manager_form_alter in ./simplenews_roles.module
Implementation of hook_form_FORM_ID_alter() for simplenews_subscription_manager_form
simplenews_roles_form_user_profile_form_alter in ./simplenews_roles.module
Implementation of hook_form_FORM_ID_alter() for user_profile_form

File

./simplenews_roles.module, line 172
Simplenews Roles module

Code

function _simplenews_roles_form_alter_subscriptions(&$form, $account = NULL) {
  $tids = simplenews_roles_filter_tids(array_keys($form['newsletters']['#options']), $account);
  foreach (array_keys($form['newsletters']['#options']) as $tid) {
    if (!in_array($tid, $tids)) {
      unset($form['newsletters']['#options'][$tid]);
    }
  }
}