You are here

function _simplenews_user_load in Simplenews 6.2

Same name and namespace in other branches
  1. 5 simplenews.module \_simplenews_user_load()
  2. 6 simplenews.module \_simplenews_user_load()

Load a user or creates a dummy anonymous user.

Return value

account object ( mail, email address uid, uid or 0 for anonymous )

4 calls to _simplenews_user_load()
SimpleNewsAdministrationTestCase::testSubscriptionManagement in tests/simplenews.test
Test newsletter subscription management.
simplenews_block_form_submit in includes/simplenews.subscription.inc
simplenews_send_test in includes/simplenews.mail.inc
Send test version of newsletter.
simplenews_subscribe_user in ./simplenews.module
Subscribe a user to a newsletter or send a confirmation mail.

File

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

Code

function _simplenews_user_load($mail) {
  $account = user_load(array(
    'mail' => $mail,
  ));
  if ($account === FALSE) {

    // Construct anonymous user since we don't have a user that matches that e-mail.
    $account = new stdClass();
    $account->uid = 0;
    $account->mail = $mail;
  }
  return $account;
}