2

I am trying to attach zodiac signs (stored as terms in a vocabulary) to user profiles.

I have a rule with a "Set data field" action that, upon updating a user profile, sets account:field-user-zodiac (a term reference to a vocabulary with 12 terms, one for each sign of the zodiac) to an arbitrary sign (Capricorn) using direct input mode (a select box of all of the terms appears).

However, upon doing so, when I update a user profile I experience a white screen of death. Disabling the rule makes the site work normally again, so obviously the rule is the problem, but I don't know how to go about fixing it.

Again, I'm trying to use "Set data value" to set a term reference field in a user profile to an arbitrary term. Any insights about how to set this up in rules?

UPDATE (Feb. 2) I figured out how to enable PHP error reporting. The error is shown below.

I'm confused as to why the fatal error is "cannot redeclare getStarSign()", because getStarSign() is a function in my computed field, yet the part of the rule causing the white screen of death is the "set data value" action, which does not refer to the computed field; "set data value" sets the taxonomy reference field. I know this is the cause because if I delete the "set data value" action the error disappears. Any ideas?

Fatal error: Cannot redeclare getStarSign() (previously declared in /home/quickstart/websites/omj.dev/sites/all/modules/contrib/computed_field/computed_field.module(465) : eval()'d code:1) in /home/quickstart/websites/omj.dev/sites/all/modules/contrib/computed_field/computed_field.module(465) : eval()'d code on line 22
Call Stack:
0.0001 668296 1. {main}() /home/quickstart/websites/omj.dev/index.php:0
0.1744 48404872 2. menu_execute_active_handler() /home/quickstart/websites/omj.dev/index.php:21
0.1753 48642216 3. call_user_func_array() /home/quickstart/websites/omj.dev/includes/menu.inc:517
0.1753 48642832 4. drupal_get_form() /home/quickstart/websites/omj.dev/includes/menu.inc:0
0.1754 48644232 5. drupal_build_form() /home/quickstart/websites/omj.dev/includes/form.inc:123
0.2481 51569552 6. drupal_process_form() /home/quickstart/websites/omj.dev/includes/form.inc:366
0.2766 52599888 7. form_execute_handlers() /home/quickstart/websites/omj.dev/includes/form.inc:846
0.2766 52607608 8. user_profile_form_submit() /home/quickstart/websites/omj.dev/includes/form.inc:1432
0.2774 52625928 9. user_save() /home/quickstart/websites/omj.dev/modules/user/user.pages.inc:317
0.3132 55387344 10. module_invoke_all() /home/quickstart/websites/omj.dev/modules/user/user.module:557
0.3134 55389880 11. call_user_func_array() /home/quickstart/websites/omj.dev/includes/module.inc:819
0.3134 55390496 12. rules_entity_update() /home/quickstart/websites/omj.dev/includes/module.inc:0
0.3134 55392016 13. rules_invoke_event() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/rules/modules/events.inc:77
0.3209 58050816 14. RulesEventSet->executeByArgs() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/rules/rules.module:777
0.3351 60502680 15. RulesState->cleanUp() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/rules/includes/rules.plugins.inc:685
0.3351 60503256 16. RulesState->saveNow() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/rules/includes/rules.state.inc:74
0.3352 60503808 17. EntityDrupalWrapper->save() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/rules/includes/rules.state.inc:229
0.3352 60503808 18. entity_save() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/entity/includes/entity.wrapper.inc:807
0.3352 60503808 19. entity_metadata_user_save() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/entity/entity.module:181
0.3352 60509520 20. user_save() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/entity/modules/callbacks.inc:707
0.3363 60525136 21. field_attach_update() /home/quickstart/websites/omj.dev/modules/user/user.module:541
0.3363 60525272 22. _field_invoke() /home/quickstart/websites/omj.dev/modules/field/field.attach.inc:958
0.3367 60535912 23. computed_field_field_update() /home/quickstart/websites/omj.dev/modules/field/field.attach.inc:209
0.3367 60535912 24. _computed_field_compute_value() /home/quickstart/websites/omj.dev/sites/all/modules/contrib/computed_field/computed_field.module:239

  • Please can you add the rules export? – WestieUK Jan 24 '12 at 16:02
  • 1
    On the white screen of death issue, see drupal.org/node/158043 – nmc Jan 24 '12 at 21:50
  • Here is the rules export: { "rules_zodiac_set_up" : { "LABEL" : "Zodiac Set Up", "PLUGIN" : "reaction rule", "REQUIRES" : [ "rules" ], "ON" : [ "user_update" ], "DO" : [ { "data_set" : { "data" : [ "account:field-user-west-zodiac" ], "value" : "22" } } ] } } @WestieUK – Patrick Kenny Jan 25 '12 at 3:01
  • 1
    I trust what you described in your own answer solved your issue (or should I say "prevented it from happening". However if that term reference field was multi value field (was it?), then the cause of your issue might have been that you should not have used "Add an item to a list" instead of "set a data value". For more details about that, refer to my answer to this question. – Pierre.Vriens Feb 17 '17 at 11:11
0

I finally located the cause of this error. I was using a computed_field which was getting called in such a way that it was being re-declared, causing the error. Rewriting the function solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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