Is there any way to create a rule that works when user account is activated?

Comments

tryitonce’s picture

... sure, you just need to configure it. You can make it temporary = time limited, send a message to the webmaster, upgrade it after n days or n messages, and so on ....

RealGecko’s picture

Emmmm...any clues? I only see that I can create rules that are triggered when new user created and when existing user updated that are not the thing I need. I need a rule that works only once, when a new user account approved by admin or when a new user logins first time and never ever again.

sozonov’s picture

+1

hockey2112’s picture

Any luck finding a solution for this?

kbrinner’s picture

Found this in Stack Exchange:
http://drupal.stackexchange.com/questions/30219/is-there-a-hook-after-us...

Although this approach uses modules, I add nodes after users confirm their e-mails using Logintoboggan and Rules. The Logintoboggan rules integration adds a new event, When the user account is validated, which will allow you to perform actions upon e-mail confirmation.

Also suggested using hook_user_presave

/**
 * Implements @see hook_user_presave
 */
function hook_user_presave(&$edit, $account, $category) {
  if ($account->uid // user is not new
      && $account->status === "0" && $edit['status']==1) { // user is being activated
  }
}
matrobin’s picture