Add ambassador, community manager user roles

Add ambassador and community manager user roles and display labels under
profile picture.

Change-Id: I0aac9d24e8c68ce11b483922aba99bd4ba066479
This commit is contained in:
Marton Kiss 2015-01-20 20:31:42 +01:00
parent a9051b4bc9
commit d8805d3fbe
5 changed files with 63 additions and 3 deletions

View File

@ -0,0 +1,26 @@
<?php
/**
* @file
* groups_groups.features.user_role.inc
*/
/**
* Implements hook_user_default_roles().
*/
function groups_groups_user_default_roles() {
$roles = array();
// Exported role: ambassador.
$roles['ambassador'] = array(
'name' => 'ambassador',
'weight' => 11,
);
// Exported role: community_manager.
$roles['community_manager'] = array(
'name' => 'community_manager',
'weight' => 12,
);
return $roles;
}

View File

@ -10,9 +10,9 @@ dependencies[] = field_group_location
dependencies[] = field_property_list
dependencies[] = geocoder
dependencies[] = geofield
dependencies[] = groups_common
dependencies[] = list
dependencies[] = options
dependencies[] = groups_common
features[features_api][] = api:2
features[field_base][] = field_geofield
features[field_base][] = field_group_location
@ -22,3 +22,6 @@ features[field_instance][] = node-group-field_geofield
features[field_instance][] = node-group-field_group_location
features[field_instance][] = node-group-field_group_status
features[field_instance][] = node-group-field_resource_links
features[user_role][] = ambassador
features[user_role][] = community_manager
mtime = 1421351359

View File

@ -1,6 +1,6 @@
.page-user .profile {
margin-top: 1em;
margin-left: 120px;
margin-left: 140px;
color: #888;
line-height: 1.4;
a {
@ -15,7 +15,7 @@
}
.profile-sidebar {
float: left;
margin-left: -120px;
margin-left: -140px;
}
.field-name-og-user-node {
.field-label {
@ -39,4 +39,8 @@
text-align: left;
font-size: 30px;
}
/* profile role labels aligned under profile picture */
.profile-roles .profile-row {
margin-top: 0.5em;
}
}

View File

@ -228,4 +228,25 @@ function openstack_bootstrap_preprocess_views_view(&$variables) {
if (strpos($view->name, 'commons_bw_') !== false) {
$variables['exposed'] = '';
}
}
/**
* Implements template_preprocess_user_profile()
*/
function openstack_bootstrap_preprocess_user_profile(&$variables) {
$user = $variables['user'];
if (in_array('ambassador', $user->roles)) {
$variables['user_profile']['role_ambassador'] = array(
'#prefix' => '<span class="label label-info">',
'#markup' => t('Ambassador'),
'#suffix' => '</span>',
);
}
if (in_array('community_manager', $user->roles)) {
$variables['user_profile']['role_community_manager'] = array(
'#prefix' => '<span class="label label-info">',
'#markup' => t('Community Manager'),
'#suffix' => '</span>',
);
}
}

View File

@ -37,6 +37,12 @@
<div class="profile"<?php print $attributes; ?>>
<div class="profile-sidebar">
<?php print render($user_profile['user_picture']); ?>
<?php if (!empty($user_profile['role_ambassador']) || !empty($user_profile['role_community_manager'])): ?>
<div class="profile-roles">
<div class="profile-row"><?php print render($user_profile['role_ambassador']); ?></div>
<div class="profile-row"><?php print render($user_profile['role_community_manager']); ?></div>
</div>
<?php endif; ?>
</div>
<?php print render($user_profile['og_user_node']); ?>
<?php print render($user_profile['summary']); ?>