Posted by Tim_O on October 20, 2009 at 10:20pm
2 followers
Jump to:
| Project: | Rules |
| Version: | 6.x-1.1 |
| Component: | Rules Engine |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I have been reading around this for two days now, but I cannot get it solved. I don't want yet another module (there are ways with content_profile or something), but I want to solve this with rules and the core profile.
What I am trying to achieve is to
- trigger when a user is created (works),
- create a node (works)
- write the nid of that node into a custom-profile field (this is my problem)
My current try is to use something like the following in "Execute custom PHP code"
$account->profile_homegroup=$node_added->nid;
return array("account" => $account);Both variables ($account and $node_added) are reported to be available, so it probably is a syntax thing or something?
Would appreciate any help. Will write this down to the handbook or FAQ, if someone just explains it to me, as I couldn't find any PHP-example writing content at all, not even talking about this profile issue.
Comments
#1
I managed to achieve this by the following rules:
1) saving my modified node using "save content"
2) loading that content again using a token for the node-id
3) then using the following code in a "custom php" rule:
$edit = array( 'profile_nameofprofilefield' => $loaded_node->nid );profile_save_profile($edit, $account, "categoryname of the profile-field here");
I will try to add something to the documentation on this as well.
#2
I've put some documentation at http://drupal.org/node/632140 ...
#3
Automatically closed -- issue fixed for 2 weeks with no activity.