Closed (fixed)
Project:
Promotion
Version:
5.x-1.9
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2008 at 04:55 UTC
Updated:
12 May 2008 at 00:02 UTC
I am trying to configure a workflow-ng workflow based on whether a user who just registered has entered a promotion code or not. So I need some variable or argument accessible from a PHP Code box that I can base a conditional on to determine the direction of the workflow. Something like:
if ($promotion_code) return TRUE;
else return FALSE;
I imagine this would be useful for many tasks in addition to workflow-ng.
Comments
Comment #1
dafederI've been trying this code, which seems like it should work but doesn't. I'm suspecting the php just isn't being executed, is that possible?
Comment #2
zostay commentedI'm not sure why the code snippet you've suggested there isn't working. I would have written it like this though:
I come from Perl and naturally prefer one-liners. ;)
I'm familiar with workflow-ng, but I haven't written conditions in PHP before, so I don't know how they are supposed to fail or succeed. However, that snippet above should return true if the user has a valid promotion code and false if he does not.
I also do not know when you are running this. If you are running it during User Registration, it might be possible that the workflow-ng hook is running before the promotion module hook, which would cause the snippet to be false anyway.
If you do find a way to make it work or a patch for the module, please let me know and I'll consider incorporating it.
Comment #3
dafederI've got this working - I'm not sure if it was switching "true" and "false" (i had them backwards with a "negate" before, maybe that's not correct?) or using $account instead of $user. Anyway, here's the workflow export:
Comment #4
zostay commentedI'm going to assume this is resolved, then, unless you need something else.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.