You are here

function simplenews_get_newsletters in Simplenews 6.2

Get array of newsletters with names translated.

If required newsletter names are translated based on the global language. Hidden newsletters (opt-in/out setting is 'hidden') are not included.

Parameters

int $vid: Newsletter vocabulary ID

boolean $show_all: On false hidden newsletters will not be returned. On true all newsletter will be returned.

Return value

array of newsletters objects.

13 calls to simplenews_get_newsletters()
simplenews_admin_export_after_build in includes/simplenews.admin.inc
simplenews_block in ./simplenews.module
Implementation of hook_block().
simplenews_get_filter in includes/simplenews.admin.inc
Built filter selection box options and filter query where clause
simplenews_subscriptions_account_form in includes/simplenews.subscription.inc
FAPI ACCOUNT subscription form.
simplenews_subscriptions_admin_form in includes/simplenews.subscription.inc
FAPI ADMIN subscription form.

... See full list

File

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

Code

function simplenews_get_newsletters($vid, $show_all = FALSE, $reset = FALSE) {
  static $newsletters = NULL;
  if (is_array($newsletters) && !$reset) {
    return $newsletters;
  }
  $newsletters = array();
  foreach (taxonomy_get_tree($vid) as $term) {
    if (variable_get('simplenews_opt_inout_' . $term->tid, 'double') != 'hidden' || $show_all) {
      $newsletter = new stdClass();
      $newsletter->tid = $term->tid;
      $newsletter->name = _simplenews_tt_newsletter_name($term);
      $newsletters[$term->tid] = $newsletter;
    }
  }
  return $newsletters;
}