How do I create a variable from a PHP action?

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Are you sure you created an issue against the right project?

ErnestoJaboneta’s picture

I'm using the "Execute custom PHP Code" action. I'm not sure where that option came from, I assumed it was either Rules or Core's php module. I asked here since it was probably more of a rules question. Maybe I should ask, how do I programmatically create a variable in the middle of a rules execution? Is this possible?

dawehner’s picture

Project: Views (for Drupal 7) » Rules
Version: 7.x-3.x-dev » 7.x-2.x-dev
Component: Miscellaneous » Documentation

Yeah but you filled an issue against views ...

mitchell’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

I don't believe this is a documentation issue. See #1223218: PHP Filter: 'Add a variable' text token does not work.

JordiTR’s picture

I know this is an old issue but Ernesto was true, I'm facing the same trouble and the issue pointed by mitchell is not a solution.

What if I need to use the "Execute PHP custom code" to make complex calculations with several values that I want assign to another action as grantting points to a user? I can't, because I can use the "Execute PHP custom code" action but it just "executes" there is no option to assign a variable name to the result of the PHP calculation. Or is it possible?

candelas’s picture

same problem here and i dont find documentation about it...

candelas’s picture

i saw in https://drupal.org/node/1878018#comment-7780267 a solution that was good for me.

Posted by rbrownell on August 21, 2013 at 7:00pm

Not sure if this helps but you can use PHP to generate the output of the "Add a variable" action (for text).

i passed my code in "evaluate php" and then i could use the variable after :)