function _commons_create_demo_groups in Drupal Commons 7.3
BatchAPI callback.
See also
commons_demo_content()
1 string reference to '_commons_create_demo_groups'
- commons_install_additional_modules in ./
commons.install - Task callback: uses Batch API to enable modules based on user selection.
File
- ./
commons.install_callbacks.inc, line 89 - Contains Batch API callbacks used during installation.
Code
function _commons_create_demo_groups($operation, &$context) {
$context['message'] = t('@operation', array(
'@operation' => $operation,
));
$demo_users = $context['results']['users'];
// Group: Boston
$boston_group = new stdClass();
$boston_group->type = 'group';
node_object_prepare($boston_group);
$boston_group->title = 'Boston';
$boston_group->body[LANGUAGE_NONE][0]['value'] = commons_veggie_ipsum();
$boston_group->uid = $demo_users['Jeff Noyes']->uid;
$boston_group->language = LANGUAGE_NONE;
$boston_group->created = time() - 604800;
$boston_group->status = 1;
node_save($boston_group);
$context['results']['groups']['boston'] = $boston_group;
// Group: New York City
$nyc_group = new stdClass();
$nyc_group->type = 'group';
node_object_prepare($nyc_group);
$nyc_group->title = 'New York City';
$nyc_group->body[LANGUAGE_NONE][0]['value'] = commons_veggie_ipsum();
$nyc_group->uid = $demo_users['Drew Robertson']->uid;
$nyc_group->language = LANGUAGE_NONE;
$nyc_group->status = 1;
// Make the group 1 week old:
$nyc_group->created = time() - 604800;
node_save($nyc_group);
$context['results']['groups']['new_york_city'] = $nyc_group;
}