Enable group registration workflow
New registration link and new group review queue link added to user profile page of users with ambassador or community manager roles. The registration workflow had been enabled so a new group must be approved by an ambassador or community mgr. Change-Id: I8b633f122da7c6a442f109211214fe7ecec250dc
This commit is contained in:
parent
a033a390c3
commit
e8ac3ba589
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* groups_groups.features.user_permission.inc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_user_default_permissions().
|
||||
*/
|
||||
function groups_groups_user_default_permissions() {
|
||||
$permissions = array();
|
||||
|
||||
// Exported permission: 'access administration pages'.
|
||||
$permissions['access administration pages'] = array(
|
||||
'name' => 'access administration pages',
|
||||
'roles' => array(),
|
||||
'module' => 'system',
|
||||
);
|
||||
|
||||
// Exported permission: 'access content overview'.
|
||||
$permissions['access content overview'] = array(
|
||||
'name' => 'access content overview',
|
||||
'roles' => array(
|
||||
'ambassador' => 'ambassador',
|
||||
'community_manager' => 'community_manager',
|
||||
),
|
||||
'module' => 'node',
|
||||
);
|
||||
|
||||
// Exported permission: 'edit any group content'.
|
||||
$permissions['edit any group content'] = array(
|
||||
'name' => 'edit any group content',
|
||||
'roles' => array(
|
||||
'ambassador' => 'ambassador',
|
||||
'community_manager' => 'community_manager',
|
||||
),
|
||||
'module' => 'node',
|
||||
);
|
||||
|
||||
return $permissions;
|
||||
}
|
|
@ -13,8 +13,10 @@ dependencies[] = geocoder
|
|||
dependencies[] = geofield
|
||||
dependencies[] = groups_common
|
||||
dependencies[] = list
|
||||
dependencies[] = node
|
||||
dependencies[] = number
|
||||
dependencies[] = options
|
||||
dependencies[] = system
|
||||
dependencies[] = views
|
||||
features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
|
@ -30,8 +32,11 @@ features[field_instance][] = node-group-field_group_location
|
|||
features[field_instance][] = node-group-field_group_status
|
||||
features[field_instance][] = node-group-field_meetup_members
|
||||
features[field_instance][] = node-group-field_resource_links
|
||||
features[user_permission][] = access administration pages
|
||||
features[user_permission][] = access content overview
|
||||
features[user_permission][] = edit any group content
|
||||
features[user_role][] = ambassador
|
||||
features[user_role][] = community_manager
|
||||
features[views_view][] = groups_ambassadors
|
||||
features_exclude[dependencies][ctools] = ctools
|
||||
mtime = 1423845401
|
||||
mtime = 1424680610
|
||||
|
|
|
@ -49,11 +49,12 @@ function groups_groups_field_default_field_instances_alter(&$fields) {
|
|||
/**
|
||||
* Implement hook_node_prepare
|
||||
*
|
||||
* Add a default published status to group content type.
|
||||
* Add a default not published status to group content type,
|
||||
* so group will be placed at review queue.
|
||||
*/
|
||||
function groups_groups_node_prepare($node) {
|
||||
if (($node->type == 'group') && (empty($node->nid))) {
|
||||
$node->status = NODE_PUBLISHED;
|
||||
$node->status = NODE_NOT_PUBLISHED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -249,4 +249,29 @@ function openstack_bootstrap_preprocess_user_profile(&$variables) {
|
|||
'#suffix' => '</span>',
|
||||
);
|
||||
}
|
||||
if ((in_array('community_manager', $account->roles)) ||
|
||||
(in_array('ambassador', $account->roles))) {
|
||||
$pending_groups = db_select('node', 'n')
|
||||
->fields('n')
|
||||
->condition('n.status', 0, '=')
|
||||
->countQuery()
|
||||
->execute()
|
||||
->fetchField();
|
||||
if ($pending_groups > 0) {
|
||||
$content = l(t('@pending group(s) waiting in the review queue', array('@pending' => $pending_groups)),
|
||||
'admin/content/groups');
|
||||
} else {
|
||||
$content = t('No new groups waiting in the review queue.');
|
||||
}
|
||||
$variables['user_profile']['pending_groups'] = array(
|
||||
'#prefix' => '<h3>'.t('Groups waiting for approval').'</h3>',
|
||||
'#markup' => $content,
|
||||
);
|
||||
}
|
||||
if (user_is_logged_in()) {
|
||||
$variables['user_profile']['register_new_group'] = array(
|
||||
'#prefix' => '<h3>'.t('Groups registration').'</h3>',
|
||||
'#markup' => l('Register a new user group', 'node/add/group'),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -46,4 +46,6 @@
|
|||
</div>
|
||||
<?php print render($user_profile['og_user_node']); ?>
|
||||
<?php print render($user_profile['summary']); ?>
|
||||
<?php print render($user_profile['pending_groups']); ?>
|
||||
<?php print render($user_profile['register_new_group']); ?>
|
||||
</div>
|
Loading…
Reference in New Issue