I'm trying to create a rule that, when triggered, will update a CCK user reference field with the user info of the current user only. I want the user to edit the node with just his own user info in a CCK user reference field. (My permissions are set correctly and the CCK user field is built to allow unlimited entries, but I only want my users to be able to add themselves. I am triggering the rule using views bulk operations from a view of several nodes of their type, so that users can edit this field on multiple nodes at a time.)

It seems like the rule needs an action like edit 'field_myfieldname' but I don't know PHP and I'm not sure what to enter here to get just the current user's info to return in the user reference field. Any help?

Comments

thewoodm’s picture

Component: Rules Core » Rules Engine

OK; the following code works to update the field with the current user:

global $user;
return array(
0=> array('uid' => $user->uid)
);

What I need now is to keep existing field information intact and to ADD users when the rule is triggered; this script wipes the field for the node, and then adds the user.

tr’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes
Status: Active » Closed (outdated)