I'm trying to grant Userpoints to users with a Rule. The Rule first calculates two integer values 'New value' and 'Old value'. Debugging these numbers shows that there's no problem with them. Naturally, I tried awarding the points with an action "Grant points to a user" and I'm using the following code in the PHP evaluation:
if ($value > 5) { return 0; } else { return token_replace('[new-value]'); } where the default $value is old-value. As the [new-value] token is available in the data selectors of the 'Points' section of the action, I suppose that one can use it in the PHP evaluation too. Therefore, after reading Token Replacements, I thought my code should work, but it doesn't: the Userpoints aren't granted to the user.
There's definitively something wrong with the Token, because the Rule is executed correctly when I use 1 instead of token_replace('[new-value]').
What am I doing wrong and how can I solve this?