Closed (fixed)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Provided Module Integrations
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Aug 2009 at 13:44 UTC
Updated:
26 May 2012 at 18:35 UTC
Hi,
Can rules be configured to automatically create a organic group based on a user profile promotion?
What would I need to start to look at?
cheers
Comments
Comment #1
gpk commentedI've just started playing with Rules and yes, you can configure Rules to create a node of specified type when a user registers, but at the moment I can't see how to populate the node body (you can populate the node title) nor how to drag in info from the user profile (tho' you have access to username and uid etc.). You can also populate CCK fields.
Rules looks very powerful so it certainly *should* be able to do the sort of thing you are after but whether your specific requirements have been coded up yet is another question. Good luck!!
Comment #2
juicytoo commentedHi Giles,
Thanks for listening.
I will play around with it in the next week or so and report back.
cheers
Comment #3
gpk commentedMight be worth asking in the Rules "group" ... see the bottom of the main Rules project page, under "Useful links".
Comment #4
amitaibuyou already have actions to create a node, and then to set group settings on that node. I don't know about "profile promotion" event.
Comment #5
gpk commented@2: you can probably access user profile fields by using the PHP evaluation box (you may need to activate PHP module first). $account->profile_fieldname will probably return the value of the relevant field, so if there was a way to populate the node body (which I've not found yet, but may well be there!!) you could set its value something like
print 'This group has been created by ' . check_plain($account->profile_fullname) . ' who lives at ' . check_plain($account->address);where fullname and address are the 2 profile fields you have set up. http://api.drupal.org/api/function/check_plain/6 prevents cross-site scripting attacks via the user input.
A completely different approach might be to use ? content profile module which makes users into nodes IIRC, and set the relevant content type to be a group node. This would avoid having the group info duplicated in the user's profile.
Comment #6
gpk commentedAha, found it, you would need to use the Action "Execute custom PHP code" (make sure PHP module is enabled). This lets you modify the $node_added that was created in an earlier step directly, e.g.
Once there is an action to populate the node body directly, and once tokens for user profile fields are available, you wouldn't need to do it this way.
Comment #7
mitchell commentedLooks fixed to me.
Comment #9
mitchell commentedUpdated component.