Skip to content

Commit

Permalink
Hide ‘Report Issue’ when user doesn’t have access
Browse files Browse the repository at this point in the history
Fixes #21223
  • Loading branch information
vboctor committed Jul 22, 2016
1 parent 1ae70e8 commit e32fda7
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions core/layout_api.php
Expand Up @@ -538,19 +538,29 @@ function layout_navbar_button_bar() {
return;
}

$t_can_report_bug = access_has_project_level( config_get( 'report_bug_threshold' ) );
$t_can_invite_user = current_user_is_administrator();

if( !$t_can_report_bug && !$t_can_invite_user ) {
return;
}

echo '<li class="hidden-sm hidden-xs">';
echo '<div class="btn-group btn-corner padding-right-8 padding-left-8">';

$t_bug_url = string_get_bug_report_url();
echo '<a class="btn btn-primary btn-sm" href="' . $t_bug_url . '">';
echo '<i class="fa fa-edit"></i> ' . lang_get( 'report_bug_link' );
echo '</a>';
if( $t_can_report_bug ) {
$t_bug_url = string_get_bug_report_url();
echo '<a class="btn btn-primary btn-sm" href="' . $t_bug_url . '">';
echo '<i class="fa fa-edit"></i> ' . lang_get( 'report_bug_link' );
echo '</a>';
}

if( current_user_is_administrator() ) {
if( $t_can_invite_user ) {
echo '<a class="btn btn-primary btn-sm" href="manage_user_create_page.php">';
echo '<i class="fa fa-user-plus"></i> ' . lang_get( 'invite_users' );
echo '</a>';
}

echo '</li>';
}

Expand Down

0 comments on commit e32fda7

Please sign in to comment.