You are here

function _simplenews_get_newsletter_settings in Simplenews 6.2

This helper function retrieves simplenews settings from database and formats in for simplenews friendly default structure.

Parameters

stdClass $node: $node for which we are looking for simplenews settings

Return value

array Function returns simplenews settings or NULL value

1 call to _simplenews_get_newsletter_settings()
simplenews_nodeapi in ./simplenews.module
Implementation of hook_nodeapi().

File

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

Code

function _simplenews_get_newsletter_settings(stdClass $node) {
  $simplenews = db_fetch_array(db_query('
      SELECT *
      FROM {simplenews_newsletters}
      WHERE nid = %d', $node->nid));
  if (is_array($simplenews)) {
    $advanced_settings = array(
      's_format',
      'priority',
      'receipt',
    );
    $simplenews['advanced'] = array();
    foreach ($advanced_settings as $adv_field) {
      $simplenews['advanced'][$adv_field] = $simplenews[$adv_field];
      unset($simplenews[$adv_field]);
    }
    return $simplenews;
  }
  else {
    return NULL;
  }
}