0

I have [order:products:0:node:author:uid] as rules data selection token. In data selection mode that works perfectly, and adds the exact data right where I need it, but when I add that token into the database table, using Execute custom PHP code and the following this code, I get only a blank destination field with no value.

$nid = db_insert('mytable') ->fields(array(
  'uid' => $uid,
  'username' => $username,
  'addr' => $address,
  'destination' => "[order:products:0:node:author:uid]"
))
  ->execute();

All the other fields are filling correctly.

What could the problem be?

1
  • Actually now I am receiving "[order:products:0:node:author:uid]" in the value of the needed field, but I am receiving that as a text, not as actual uid.
    – querydb
    Mar 26, 2018 at 21:09

1 Answer 1

0

Yes, that kind of tokens are not being replaced, because god only knows why, but I solved my problem by adding variable to the needed rule, placing it before the executing php code, and selecting user entity by data selection there, and making reference to it in a php code. That is how it worked. Thank you, Jdrupal for your answer, anyway, it is always helpful to learn something new.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.