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:
Marton Kiss
2015-02-23 10:19:54 +01:00
parent a033a390c3
commit e8ac3ba589
5 changed files with 77 additions and 3 deletions

View File

@@ -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'),
);
}
}

View File

@@ -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>