You are here

function simplenews_user_login in Simplenews 7

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_user_login()
  2. 8 simplenews.module \simplenews_user_login()
  3. 7.2 simplenews.module \simplenews_user_login()
  4. 3.x simplenews.module \simplenews_user_login()

Implements hook_user_login().

Subscribe user to a newsletter as per registration form.

File

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

Code

function simplenews_user_login(&$edit, $account) {

  // Subscriptions of users that did sign up by themselves have to be
  // activated first at their first login (-> account::access = 0)
  if ($account->access == 0) {
    $query = db_update('simplenews_subscriber')
      ->fields(array(
      'activated' => SIMPLENEWS_SUBSCRIPTION_ACTIVE,
    ))
      ->condition('uid', $account->uid)
      ->execute();
  }
}