You are here

function _simplenews_user_load in Simplenews 6

Same name and namespace in other branches
  1. 5 simplenews.module \_simplenews_user_load()
  2. 6.2 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 )

2 calls to _simplenews_user_load()
simplenews_block_form_submit in ./simplenews.module
simplenews_subscribe_user in ./simplenews.module
Subscribe a user to a newsletter or send a confirmation mail.

File

./simplenews.module, line 965
Simplnews 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-amil.
    $account = new stdClass();
    $account->uid = 0;
    $account->mail = drupal_strtolower($mail);
  }
  return $account;
}