You are here

function _simplenews_user_load in Simplenews 5

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

Helper function for API functions; loads a user or creates a dummy anonymous user with uid = 0 and $mail equal to the input param.

4 calls to _simplenews_user_load()
simplenews_block_form_submit in ./simplenews.module
Forms API callback; handles block form (un)subscribe submissions.
simplenews_get_user_subscription in ./simplenews.module
API function; returns the subscription for the given e-mail address.
simplenews_subscribe_user in ./simplenews.module
API function; subscribes a user to a newsletter.
simplenews_user_is_subscribed in ./simplenews.module
API function; returns if the user's e-mail address is subscribed to the given newsletter.

File

./simplenews.module, line 791

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 = strtolower($mail);
  }
  return $account;
}