Various changes
mobile-friendly ui updates admin user-edit bugfix file cleanup added searchFields add blog search remove unused code add maintenance mode config
This commit is contained in:
@ -27,6 +27,7 @@ use TheTempusProject\Models\User;
|
||||
use TheTempusProject\Models\Group;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Houdini\Classes\Template;
|
||||
use TheTempusProject\Bedrock\Functions\Upload;
|
||||
|
||||
class Users extends AdminController {
|
||||
public static $user;
|
||||
@ -104,7 +105,7 @@ class Users extends AdminController {
|
||||
}
|
||||
|
||||
if ( Input::exists( 'submit' ) ) {
|
||||
if ( !FormChecker::check( 'editUser' ) ) {
|
||||
if ( ! FormChecker::check( 'editUser' ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
} else {
|
||||
$fields = [
|
||||
@ -112,6 +113,25 @@ class Users extends AdminController {
|
||||
'email' => Input::post( 'email' ),
|
||||
'userGroup' => Input::post( 'groupSelect' ),
|
||||
];
|
||||
|
||||
if ( Input::exists( 'avatar' ) ) {
|
||||
$folder = UPLOAD_DIRECTORY . $userData->username . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
|
||||
$upload = Upload::image( 'avatar', $folder );
|
||||
if ( $upload ) {
|
||||
$route = str_replace( APP_ROOT_DIRECTORY, '', $folder );
|
||||
$prefs = [];
|
||||
$prefs['avatar'] = $route . Upload::last();
|
||||
|
||||
self::$user->updatePrefs( $prefs, $userData->ID );
|
||||
} else {
|
||||
Issues::add( 'error', [ 'There was an error with your avatar.' => Check::userErrors() ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Input::exists( 'password' ) ) {
|
||||
$fields['password'] = Hash::make( Input::post( 'password' ) );
|
||||
}
|
||||
|
||||
if ( Input::exists( 'confirmed' ) ) {
|
||||
$fields['confirmed'] = 1;
|
||||
} else {
|
||||
@ -119,6 +139,7 @@ class Users extends AdminController {
|
||||
$fields['confirmationCode'] = Code::genConfirmation();
|
||||
}
|
||||
}
|
||||
|
||||
if ( self::$user->update( $userData->ID, $fields ) ) {
|
||||
Issues::add( 'success', 'User Updated.' );
|
||||
return $this->index();
|
||||
|
Reference in New Issue
Block a user