Checking and Setting User Session variables with Rules

Events happening in the community are now at Drupal community events on www.drupal.org.
tedbow's picture

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?

jayhariani's picture

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

sachand's picture

I have same requirement, any updates on this ?

Sachand

No built in way, you need to

j0rd's picture

No built in way, you need to use custom PHP.

<?php
$_SESSION
['what'] = $account->uid;
?>

Pretty easy.

ok, this will set a session

stoltoguzzi's picture

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?

densolis's picture

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

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: