You are here

function simplenews_load_user_by_mail in Simplenews 7.2

Same name and namespace in other branches
  1. 7 simplenews.module \simplenews_load_user_by_mail()

Load a user or creates a dummy anonymous user.

Return value

A user object if a user with that mail address exists, otherwise an object with the properties mail and uid (set to 0).

Related topics

4 calls to simplenews_load_user_by_mail()
simplenews_block_form_submit in includes/simplenews.subscription.inc
simplenews_rules_map_confirmation in simplenews_rules/simplenews_rules.rules.inc
Map args to the confrmation argument for subscribing/unsubscribing.
simplenews_subscribe in ./simplenews.module
Subscribe a user to a newsletter or send a confirmation mail.
simplenews_subscriptions_page_form_submit in includes/simplenews.subscription.inc
FAPI PAGE subscription form_submit.

File

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

Code

function simplenews_load_user_by_mail($mail) {
  $account = user_load_by_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;
}