Skip to content

Commit

Permalink
Avoid calling profile_is_global() twice
Browse files Browse the repository at this point in the history
Profile API has no cache, so this causes unnecessary execution of
another DB query.

Fixes #27258
  • Loading branch information
dregad committed Sep 18, 2020
1 parent a39ee9a commit 39142cd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions account_prof_edit_page.php
Expand Up @@ -61,9 +61,9 @@
$f_profile_id = gpc_get_int( 'profile_id' );
$f_redirect_page = gpc_get_string( 'redirect', 'account_prof_menu_page.php' );

if( profile_is_global( $f_profile_id ) ) {
$t_global_profile = profile_is_global( $f_profile_id );
if( $t_global_profile ) {
access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) );

$t_row = profile_get_row( ALL_USERS, $f_profile_id );
} else {
$t_row = profile_get_row( auth_get_current_user_id(), $f_profile_id );
Expand All @@ -81,9 +81,8 @@

layout_page_header();

layout_page_begin( 'manage_overview_page.php' );

if( profile_is_global( $f_profile_id ) ) {
if( $t_global_profile ) {
layout_page_begin( 'manage_overview_page.php' );
print_manage_menu( 'manage_prof_menu_page.php' );
}
?>
Expand Down

0 comments on commit 39142cd

Please sign in to comment.