You are here

function simplenews_count_subscriptions in Simplenews 6.2

Same name and namespace in other branches
  1. 8 simplenews.module \simplenews_count_subscriptions()
  2. 7.2 includes/simplenews.admin.inc \simplenews_count_subscriptions()
  3. 7 includes/simplenews.admin.inc \simplenews_count_subscriptions()

Count number of subscribers per newsletter series.

Return value

number of subscribers.

1 call to simplenews_count_subscriptions()
simplenews_types_overview in includes/simplenews.admin.inc
Menu callback: newsletter admin form with list of available newsletter series.

File

includes/simplenews.admin.inc, line 1333
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_count_subscriptions($tid) {
  static $subscription_count;
  if (isset($subscription_count[$tid])) {
    return $subscription_count[$tid];
  }
  $subscription_count[$tid] = db_result(db_query('
    SELECT COUNT(*)
    FROM {simplenews_snid_tid}
    WHERE tid = %d
      AND status = %d', $tid, SIMPLENEWS_SUBSCRIPTION_STATUS_SUBSCRIBED));
  return $subscription_count[$tid];
}