0

First time using Rules to make a complicated rule. Would appreciate some help. I'm making rules to send an e-mail, to a pre-defined e-mail address, after an existing node is updated. This node is of a certain type, and this type has a taxonomy term reference field. When any node of this type gets updated, by a user with certain role, Drupal should send an e-mail, and in the e-mail it should attach the name of the taxonomy term.

tl;dr/problem: What I'm having trouble is, when creating a condition to check the user's role (the user who updated the content, not the author). There seems to be only the "Author" of the node available on the Data selector (see attached image). Is node:author the correct one to check for the user who updated the content?

user data selector

  • There seems to be a "site:current-user" selector as well. Is this the correct one? I'm not sure how reliable this is when multiple users are logged in to the system? – Beebee Jul 12 '12 at 10:40
  • 1
    Yes, it is site:current-user. Everything is OK with multiple logged in users. – kalabro Jul 12 '12 at 10:42
1

For your task you need site:current-user token which corresponds to $GLOBALS['user'] (global $user) object.

I'm not sure how reliable this is when multiple users are logged in to the system?

Webserver creates new PHP thread (or process) for each request so there are no sharing variables between requests.global $user variable is initialized by Drupal on every request.

When you have just updated a node you can use global $user to know who updated this node. At any time after updating you can get that user id from revision ($node->revision_uid).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.