Here's the situation: I've set up a volunteer registration system using Flags. Each shift is a node that can be flagged by the user. Users can sign up for 1-4 shifts, and with each shift added, their role changes:volunteer, oneshift, twoshift, threeshift, and fourshift. When they hit fourshift, they can't access the flag any more.

Releasing shifts needs to be in control of the volunteer coordinator, which I've set up using Views. I need a rule to go along with that downgrades the volunteer's role if the coordinator removes a shift: for instance, a fourshift would get changed to a threeshift. I'm going to need some php code to do this, because the standard rule options only work if the volunteer themselves releases the shift.

I have a user reference field in the shift node which links it to the user who flags it, so I've set the rule to load the user referenced by the field, and that gives me access to the $referenced_user variable. But I don't know how to set up the php code to change their roles...I either get an error or nothing. I want to check for the role they've got, remove it, and add the next role down. Can anyone help on this?

Comments

mitchell’s picture

Component: Rules Core » Rules Engine
Status: Active » Closed (fixed)

Closing older issues to make the issue queue easier to navigate. If you still need assistance, please try the latest versions, read through the documentation handbooks, and search for other other issues with relevant responses. This will more than likely give you an answer to your question, or you can always open another issue. If you have any further help to offer people who may find this issue, please add it even though it is closed or add this info to the documentation handbook. Thank you.