From 81bbee543727c9f5c2cf16fb2dbc0f7c43960248 Mon Sep 17 00:00:00 2001 From: Marton Kiss Date: Mon, 23 Feb 2015 10:46:07 +0100 Subject: [PATCH] Add report links to user profile Add report links to user profile, visible only on profile of community managers and ambassadors. Change-Id: I7e8e5946e6a4097f18829f0179c73bd2315c3d1b --- themes/openstack_bootstrap/template.php | 12 ++++++++++-- .../templates/user-profile.tpl.php | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/themes/openstack_bootstrap/template.php b/themes/openstack_bootstrap/template.php index efbf876..98e5c57 100755 --- a/themes/openstack_bootstrap/template.php +++ b/themes/openstack_bootstrap/template.php @@ -234,6 +234,7 @@ function openstack_bootstrap_preprocess_views_view(&$variables) { * Implements template_preprocess_user_profile() */ function openstack_bootstrap_preprocess_user_profile(&$variables) { + global $user; $account = $variables['elements']['#account']; if (in_array('ambassador', $account->roles)) { $variables['user_profile']['role_ambassador'] = array( @@ -249,8 +250,9 @@ function openstack_bootstrap_preprocess_user_profile(&$variables) { '#suffix' => '', ); } - if ((in_array('community_manager', $account->roles)) || - (in_array('ambassador', $account->roles))) { + if (((in_array('community_manager', $user->roles)) || + (in_array('ambassador', $user->roles)) || + (in_array('administrator', $user->roles))) && ($user->uid == $account->uid)) { $pending_groups = db_select('node', 'n') ->fields('n') ->condition('n.status', 0, '=') @@ -267,6 +269,12 @@ function openstack_bootstrap_preprocess_user_profile(&$variables) { '#prefix' => '

'.t('Groups waiting for approval').'

', '#markup' => $content, ); + $variables['user_profile']['reports'] = array( + '#prefix' => '

'.t('Reports').'

', + '#markup' => + '
'.l('User group membership report', 'reports/groups-membership-report').'
'. + '
'.l('Membership history report', 'reports/groups-membership-history-report').'
', + ); } if (user_is_logged_in()) { $variables['user_profile']['register_new_group'] = array( diff --git a/themes/openstack_bootstrap/templates/user-profile.tpl.php b/themes/openstack_bootstrap/templates/user-profile.tpl.php index 02bf8d4..a931628 100644 --- a/themes/openstack_bootstrap/templates/user-profile.tpl.php +++ b/themes/openstack_bootstrap/templates/user-profile.tpl.php @@ -46,6 +46,7 @@ + \ No newline at end of file