You are here

function simplenews_issue_sent_count in Simplenews 7.2

Gets or sets the sent count of a newsletter issue.

Parameters

$entity_type: Then entity_type of $entity.

$entity: The issue to get or set the status.

$value: (Optional) The sent count to be set or NULL to retrieve the current value.

Return value

The newsletter sent count. Defaults to 0.

Related topics

4 calls to simplenews_issue_sent_count()
SimpleNewsI18nTestCase::testNewsletterIssueTranslation in tests/simplenews.test
SimplenewsSendTestCase::testSendNowCronThrottle in tests/simplenews.test
Send a newsletter using cron and a low throttle.
SimplenewsSendTestCase::testSendNowNoCron in tests/simplenews.test
Send a newsletter using cron.
simplenews_mail_spool in includes/simplenews.mail.inc
Send simplenews newsletters from the spool.

File

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

Code

function simplenews_issue_sent_count($entity_type, $entity, $value = NULL) {
  $field = variable_get('simplenews_sent_count_field', 'simplenews_sent_count');
  if ($value) {
    return $entity->{$field} = array(
      LANGUAGE_NONE => array(
        array(
          'value' => $value,
        ),
      ),
    );
  }
  elseif ($status = field_get_items($entity_type, $entity, $field)) {
    return $status[0]['value'];
  }
  return 0;
}