From fe223e3b29280c7a0685d3af952dedc4963b7fe0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 29 Mar 2017 10:38:29 -0400 Subject: [PATCH] remove a warning when adding users when not logged in (could happen if OPT_AUTH isn't turned on yet --- web/includes/actions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/includes/actions.php b/web/includes/actions.php index eef058840..333367ea5 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -835,12 +835,13 @@ if ( !empty($action) ) { if ( count( $changes ) ) { if ( !empty($_REQUEST['uid']) ) { dbQuery( "update Users set ".implode( ", ", $changes )." where Id = ?", array($_REQUEST['uid']) ); + # If we are updating the logged in user, then update our session user data. + if ( $user and ( $dbUser['Username'] == $user['Username'] ) ) + userLogin( $dbUser['Username'], $dbUser['Password'] ); } else { dbQuery( "insert into Users set ".implode( ", ", $changes ) ); } $refreshParent = true; - if ( $dbUser['Username'] == $user['Username'] ) - userLogin( $dbUser['Username'], $dbUser['Password'] ); } $view = 'none'; } elseif ( $action == 'state' ) {