Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
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?
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?
Comments
Comment #1
dawehnerAre you sure you created an issue against the right project?
Comment #2
ErnestoJaboneta commentedI'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?
Comment #3
dawehnerYeah but you filled an issue against views ...
Comment #4
mitchell commentedI don't believe this is a documentation issue. See #1223218: PHP Filter: 'Add a variable' text token does not work.
Comment #5
jorditr commentedI 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?
Comment #6
candelas commentedsame problem here and i dont find documentation about it...
Comment #7
candelas commentedi 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 :)