I am looking for a way to create an organic group in code. On the Internet, I find imaginary resources on how to add node to a group, etc., but not how to create a group.
I did this using the drupal interface, but it is not very portable. I tried using the function module, although I found that it had a lot of problems. Missing fields, etc.
Through the interface, you create a group by creating new content, and then under the "organic groups" tab you select "group"
I know how to create a content type in code
$type = array(
'type' => 'Termbase2type',
'name' => t('Termbase2name'),
'base' => 'node_content',
'custom' => 1,
'modified' => 1,
'locked' => 0,
'title_label' => 'Termbase2',
'description' => a database consisting of concept-oriented terminological entries (or ‘concepts’) and related information, usually in multilingual format. Entries may include any of the following additional information: a definition; source or context of the term; subject area, domain, or industry; grammatical information (verb, noun, etc.); notes; usage label (figurative, American English, formal, etc.); author (‘created by’), creation/modification date (‘created/modified at’); verification status (‘verified’ or ‘approved’ terms), and an ID. A termbase allows for the systematic management of approved or verified terms and is a powerful tool for promoting consistency in terminology. *wiki',
'og_group_type' => 1,
'og_private' => 0,
'og_register' => 0,
'og_directory' => 0,
'og_selective' => 3,
);
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
but I can’t find clues on how to set the content type as a group, so it can have group members.