How to update/change anonymous author to authenticated current user upon logging in? This is the case:


Anonymous user can create nodes
Anonymous user will leave their email address
Anonymous user must register with the same email to "claim" the contents they created
When that user logs in, the contents with anonymous author but same email address will update then the author will change from "anonymous" to current user.


I created a rule:



I've read some posts that I just need to add events on rules, there are no "AND" "OR" to events then rules will trigger that event but I noticed that it doesn't trigger the event "user logged in". 

I tried testing this rule. changing Action, setting the value of author to ="1" ("admin") and removing condition of data comparison.

It does change the author to "admin" when saving new content either logged in or not.

When I saw that was working I returned the data comparison for the email.

Then If a user with the same email address logged in it does not change/update the author.

I tried placing the when user logged in first before the event after saving new content, as a result  I wasn't able to use the [node:etc] on comparison and action. I also tried creating a rule with just one event = "User logged in". same result, I can't find the necessary token/arg I need.

Is there something wrong with my settings? Anyone here could point me to the right direction and steps?

Thank you very much!
Try using the trigger 'after saving a new user account'.  You don't want to check for content every time they log in, just when they create an account that matches email addresses with those node.

For security purposes you should probably prevent people from being able to change their email address too or they might somehow steal someone else's content.

As for people who create content when they already have an account but are not logged in: create a rule that checks for accounts when a new node is saved.  So in summary:


New users should claim existing content when the 'after saving a new user account' is triggered.
New content by existing users (that are not logged in) should be automatically claimed by the user account upon saving the node.


Neither of these events require you to check when a user logs in.