. * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ if ( ! defined( 'ABSPATH' ) ) { die( 'Kangaroos cannot jump here' ); } class Ai1wm_Import_Users { public static function execute( $params ) { // Check multisite.json file if ( is_file( ai1wm_multisite_path( $params ) ) ) { // Set progress Ai1wm_Status::info( __( 'Preparing users...', AI1WM_PLUGIN_NAME ) ); // Read multisite.json file $handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' ); // Parse multisite.json file $multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) ); $multisite = json_decode( $multisite, true ); // Close handle ai1wm_close( $handle ); ai1wm_populate_roles(); // Set WordPress super admins if ( isset( $multisite['Admins'] ) && ( $admins = $multisite['Admins'] ) ) { foreach ( $admins as $username ) { if ( ( $user = get_user_by( 'login', $username ) ) ) { if ( $user->exists() ) { $user->set_role( 'administrator' ); } } } } // Set progress Ai1wm_Status::info( __( 'Done preparing users.', AI1WM_PLUGIN_NAME ) ); } return $params; } }