By zaffi on
I've created a feature request here: http://drupal.org/node/1417554
But here i'm asking for tips how to implement this feature myself. Here's my feature request:
Our site needs to migrate several (many) existing groups from external websites to our Drupal / OG site.
So far With DRUSH we can automatically:
create users, passwords, assign roles, and send login notification.
But I don't know how to assign multiple users to a group.
I'm new to drupal, but i'd be happy for any type of solution.
What i was thinking of was:
- commandline with Drush. independant work has been started, but is non-functional, and i did not receive any response at http://drupal.org/node/1090438. I wrote specific questions and notes about this patch on that page.
- direct DB insert - i don't know where to look, an di just started reading the API. I tried diff'ing a DB before & after a user joins, but it doesn't seem the right way.
- suggestion: import a list of users (thru text box of file upload
Where to start implementing?
Where's the OG database documented?
Comments
Adding a user to a group or
Adding a user to a group or to multiple ground can be done with the help of the og_group function.
In Drupal 7 you just need the group ID and the User-Entity - a short example should explain:
For more information: http://drupalcontrib.org/api/drupal/contributions!og!og.module/function/...
In Drupal 6 you have to use the og_subscribe_user() function:
For more information: http://drupalcontrib.org/api/drupal/contributions!og!og.module/function/...
SteffenR
views bulk operations or this
views bulk operations or this patch for feeds may help http://drupal.org/node/857424
Tentative Solution for D7
This worked to add all users to the first group created.
The API documentation states that function og_group() takes 3 arguments, but the API documentation does not match the actual code in the module.