Hi,

I'm using the Rules module to run a rather complex workflow (like "ON event, DO create nodes, set CCK information, create ubercart products etc.") and I need to transport information from one action in this workflow to a later action. To do so, I set up a new string variable $my_rule_variable and initialized it with some arbitrary value that I want to change later on. However, I don't manage to actually change the value of that variable.
If I have a rule action like

watchdog('start', $my_rule_variable);
global $my_rule_variable;
$my_rule_variable = "blub";
watchdog('end', $my_rule_variable);

then this will first output the initial value of the variable, then the new one, but the next action also gets passed the initial value, not the new one.
How can I actually change the value of $my_rule_variable?

Thanks,
Tobias

Comments

tpfeiffer’s picture

While I haven't found out how to set those variables, a workaround is storing things together with the $user object, e.g. setting
$user->my_rule_variable = 42; in one action and accessing $user->my_rule_variable from another.

altavis’s picture

Hi Tobias,

Did you find solution? Can someone tell is it possible?

tpfeiffer’s picture

I'm now using the workaround that I have posted above, using the $user variable. I don't think there is a "native" way to do that with rules.

dreftymac’s picture

saving this for later: grumpily_forgo_sea_unchosen