name ) ) :?>
roles; // Sanitize the posted roles. $new_roles = array_map( 'members_sanitize_role', $_POST['members_user_roles'] ); // Loop through the posted roles. foreach ( $new_roles as $new_role ) { // If the user doesn't already have the role, add it. if ( members_is_role_editable( $new_role ) && ! in_array( $new_role, (array) $user->roles ) ) $user->add_role( $new_role ); } // Loop through the current user roles. foreach ( $old_roles as $old_role ) { // If the role is editable and not in the new roles array, remove it. if ( members_is_role_editable( $old_role ) && ! in_array( $old_role, $new_roles ) ) $user->remove_role( $old_role ); } // If the posted roles are empty. } else { // Loop through the current user roles. foreach ( (array) $user->roles as $old_role ) { // Remove the role if it is editable. if ( members_is_role_editable( $old_role ) ) $user->remove_role( $old_role ); } } } /** * Enqueue scripts. * * @since 2.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_script( 'jquery' ); } /** * Enqueue the plugin admin CSS. * * @since 2.0.0 * @access public * @return void */ public function print_scripts() { ?> setup_actions(); } return self::$instance; } } User_New::get_instance();