Difference between "site:current-user:field-foo" and "account:field-foo" in setting a Rules condition?


In the "After saving a new user account" event, [account:field-foo] is referring to the account being saved, while [site:current-user:field-foo] is referring to the currently logged-in user, which possibly is the user who created the new account, or caused the account to be automatically created.

In the case of an administrator creating an account for another user, [site:current-user:field-foo] would be for the administrator account.

As I mentioned in the comments the variables you have available to you in a rule depend on the context it's in.

[site:current-user] is a global token available to any rule and will always return an object relating to the currently logged in user.

The [account] token is there because you're responding to the "After saving a new user account" event; that event passes an object relating to the user object that has just been saved (for obvious reasons).

I guess the main distinction is that the former will always give the currently logged in user, while the latter could be a different user object altogether (if, for example, an administrator had created the account).

Tags: Rules / Tokens

Similar questions

What's the difference between the 2 different Rules pages in admin?
What's the difference between the Rules shown under Structure > Content Types > My type > Rules and Config > Workflow > Rules? The first one is from Entity Rules (= "Instead of adding entity related events to Reaction Rules you are able to select which Rules will fire from the bundle management page"). These pages don't look the same...
What is the difference between "Limit allowed HTML tags and correct faulty HTML" and "Correct faulty and chopped off HTML"?
In CKEditor Filter processes (/admin/config/content/formats/manage/filtered_html) there are filters. If you use "Limit allowed HTML tags and correct faulty HTML" do you still also need the other one, or does this one do all that, plus limit?
Admin to Create User type Foo that can then Create User type Bar
I'm looking to build the following user structure in Drupal 8 Admin: They can create users of type Foo and Bar. Foo: They can only create user type Bar. Bar: They can only create content of a particular content type. Is this achievable with any current module release? Here are some that I found that could help contribute to a solution: I've seen pr...
How to prevent a Rules Action to happens twice using Rules Event User account validated?
I've set up a rule that sends you an HTML email when you activate your account. It seems to throw back a notification about: Notice: Undefined variable: attachment in SmtpMailSystem->mail() But it seems to send the email anyway, but what I don't understand is that I receive 2 emails everytime I test it. I've checked the log files and it seems to lo...
How to access current amount of earned userpoints in a Rules Condition?
I have no access from Rules to [points] field or any userpoints field (User points module). I have enabled: Rules, Rules scheduled, Rules_ui, Userpoints, Userponints_rules_integration, Userpoints_role (from userpoints_contrib), I have done un/installed several times one by one modules mentioned with clear cache and cron in between and nothing, no a...
Have a Rules condition that will take the current time minus last comment posted time
Overall goal: If a node has not been commented on in a given time frame, send an email. How it could possibly be done: Have Rules look at the last time a comment was posted when cron runs. Then do a data comparison of that unit (current time - last comment posted time) to see if its greater than the time frame assigned to the node (ex: hours). If s...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.