function simplenews_user_is_subscribed in Simplenews 7
Same name and namespace in other branches
- 5 simplenews.module \simplenews_user_is_subscribed()
- 6.2 simplenews.module \simplenews_user_is_subscribed()
- 6 simplenews.module \simplenews_user_is_subscribed()
- 7.2 simplenews.module \simplenews_user_is_subscribed()
Check if the email address is subscribed to the given mailing list.
@todo Caching should be done in simplenews_load_user_by_mail().
Parameters
string $mail: The email address to be checkd.
integer $tid: The mailing list id.
Return value
boolean TRUE if the email address is subscribed; otherwise false.
Related topics
8 calls to simplenews_user_is_subscribed()
- SimpleNewsAdministrationTestCase::testSubscriptionManagement in tests/
simplenews.test - Test newsletter subscription management.
- SimplenewsSubscribeTestCase::testSubscribeMultiple in tests/
simplenews.test - Subscribe to multiple newsletters at the same time.
- simplenews_block_form in includes/
simplenews.subscription.inc - FAPI BLOCK subscription form.
- simplenews_build_combined_mail in includes/
simplenews.mail.inc - Build subject and body of the subscribe confirmation email.
- simplenews_build_subscribe_mail in includes/
simplenews.mail.inc - Build subject and body of the subscribe confirmation email.
2 string references to 'simplenews_user_is_subscribed'
- SimpleNewsAdministrationTestCase::testSubscriptionManagement in tests/
simplenews.test - Test newsletter subscription management.
- SimplenewsSubscribeTestCase::testSubscribeMultiple in tests/
simplenews.test - Subscribe to multiple newsletters at the same time.
File
- ./
simplenews.module, line 1427 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_user_is_subscribed($mail, $tid) {
$subscribed =& drupal_static(__FUNCTION__, array());
if (!isset($subscribed[$mail][$tid])) {
$subscriber = simplenews_subscriber_load_by_mail($mail);
// Check that a subscriber was found, he is active and subscribed to the
// requested tid.
$subscribed[$mail][$tid] = $subscriber && $subscriber->activated && isset($subscriber->tids[$tid]);
}
return $subscribed[$mail][$tid];
}