Posted by tedbow on August 27, 2010 at 3:48pm
Is there way to set and check user session variables with the Rules module? I know I could this with custom php but I am wondering if there is built in way to this with Rules or a contrib module.
I basically want a boolean session flag. This will allow me to perform some action the first time a user views a page(or does something else).
My idea would be:
Condition:
Check session flag(or variable)
Action:
Set Session flag(or variable)
Any ideas?
Thanks

Comments
Any luck?
Curious if you ever had any luck with this. I'm trying to do something similar for an SMS-based app using rules and the smsframework.
I have same requirement, any
I have same requirement, any updates on this ?
Sachand
No built in way, you need to
No built in way, you need to use custom PHP.
<?php$_SESSION['what'] = $account->uid;
?>
Pretty easy.
Drupal & Commerce Themes
ok, this will set a session
ok, this will set a session variable
but how to get a session variable backt and use it in a rule.
something like this:
<?php$my_new_id = $_SESSION['myFatherid'] ;
?>
$my_new_id would be a rules variable but it does not work.
How about the Rules Sessions Variable module?
Tedbow
This module is a simple Rules module that allows to write/read custom
values to/from $_SESSION array. Also provides a Rules Condition to check if some value is already in $_SESSION.
https://drupal.org/project/rules_session_vars