You are here

function simplenews_user_is_subscribed in Simplenews 5

Same name and namespace in other branches
  1. 6.2 simplenews.module \simplenews_user_is_subscribed()
  2. 6 simplenews.module \simplenews_user_is_subscribed()
  3. 7.2 simplenews.module \simplenews_user_is_subscribed()
  4. 7 simplenews.module \simplenews_user_is_subscribed()

API function; returns if the user's e-mail address is subscribed to the given newsletter.

3 calls to simplenews_user_is_subscribed()
simplenews_block_form in ./simplenews.module
Show block subscription form.
theme_simplenews_newsletter_confirmation in ./simplenews.module
Construct the themable newsletter confirmation email.
_simplenews_block in ./simplenews.module
Helper function: generate block content before theming Collects data and applies access restriction

File

./simplenews.module, line 883

Code

function simplenews_user_is_subscribed($mail, $tid) {
  $account = _simplenews_user_load($mail);
  return db_num_rows(db_query("SELECT * FROM {simplenews_subscriptions} s INNER JOIN {simplenews_snid_tid} t ON s.snid = t.snid WHERE s.mail = '%s' AND s.uid = %d AND t.tid = %d", $account->mail, $account->uid, $tid)) ? TRUE : FALSE;
}