Hi,
I am trting to automatically copy a users first name from one node CCK field to another node CCK field on loading the second node. The first node already exists with the field populated.
Two content types - User Profile and Respondent Profile. 'User Profile' is a Content Profile type and is used in place of the core Profile functionality but is otherwise just a normal node.
'User Profile' has a CCK text field 'field_p_first_name' which is populated. 'Respondent Profile' has a CCK text field 'field_first_name'.
I want the value in 'field_p_first_name' to be entered into 'field_first_name' when the Respondent Profile type is loaded.
So here's what I've done with Rules:
Set a rule up to trigger on 'Respondent Profile node form is being built'.
No conditions.
Action: 'Load Content Profile' - Which makes the CCK fields available.
Action: CCK 'Populate a Field' - And choose field 'field_first_name' which opens the field text box.
Paste the token '[profile_node:field_p_first_name-raw]' into the field text box.
Save.
When I open the Create Content type 'Respondent Profile' the field remains empty. Even when I don't bother with the token and enter a test string 'Test' that will not appear either.
The log says the rule has executed:
* 0 ms "Respondent profile node form is being built" has been invoked.
* 0.14 ms Executing the rule "test" on rule set "Respondent profile node form is being built"
* 2.231 ms Loaded variable "acting user"
* 2.317 ms Action execution: "Load acting user's User Profile"
* 14.549 ms Successfully added the new variable "Content Profile"
* 14.742 ms Action execution: "Populate Content Profile's field 'field_first_name'"
* 14.887 ms Evaluation of "Respondent profile node form is being built" has been finished.
Are you able to suggest where I'm going wrong? It all seems pretty simple to me but for some reason I can't get it to work.
Any help would be most appreciated.
Thanks
Comments
Comment #1
solide-echt commentedTry use the action "Set the default value of a form element." I've had more succes with that.
Comment #2
klausiReopen if still an issue.
Comment #4
drunkencelt commentedAt last I've solved this. How simple. The 'register_globals' switch in my php.config was set to 'off' instead of 'on'.
Everything works now and how stupid do I feel?!
Comment #5
klausiredister_globals is evil and a huge security threat.
http://en.wikibooks.org/wiki/PHP_Programming/Register_Globals