Hi guys,
I'm a php programmer by trade and have built a few drupal-based sites in the past. Now I'm looking into drupal modules in more depth.
What I need to do is create an organic group when a new 'client' user account is created. This group will eventually have other users of role 'employee' assigned to them, although this will be done manually by the administrator. The roles stuff I can work out, it's the creation of the organic group where I am having difficulty.
So far I've worked out that I need to create a hook_user function with $op set to 'insert'. I also think I need to send data to og_nodeapi() with $op = 'insert' from the user hook.
How would I go about creating the form data for the group insert in a 'drupal approved' manner?
Any help is greatly appreciated.
Regards,
Sam.
Comments
I have done it this way
I have created a custom module to work as an organic group called homepage, It's user hook looks like
The update case is there because there where some existing login, it may not be needed in your case, if you use it, change 'homepage' in the sql to reflect the type you are using. Then homepage_create looks like
Thanks for the info, I'll
Thanks for the info, I'll post my results soon.
thanks a heap, this worked
thanks a heap, this worked perfectly for my needs!