usefulteam / jwt-auth

WordPress JSON Web Token Authentication
https://wordpress.org/plugins/jwt-auth/
116 stars 49 forks source link

Cant update user if error in form with plugin activate #83

Closed Dev-Ditrict-Web closed 2 months ago

Dev-Ditrict-Web commented 1 year ago

When we update a user in the admin (wp-admin/user-edit.php?user_id=1234) and there is a error on the form (example: username is empty and required) the url change to (wp-admin/user-edit.php) and your plugin trigger a die() in (class-devices.php -> custom_user_profile_fields)because there is no $_GET['user_id'] and prevent page to fully load. Why not using the $profileuser param for getting the user_id ?

// If is current user's profile (profile.php). if ( defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) { $user_id = get_current_user_id(); } elseif( ! empty( $profileuser->ID ) ) { $user_id = absint( $profileuser->ID ); // phpcs:ignore } elseif ( ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ) { // phpcs:ignore // If is another user's profile page. $user_id = absint( $_GET['user_id'] ); // phpcs:ignore } else { // Otherwise something is wrong. die( 'No user id defined.' ); }

pesseba commented 1 year ago

I will check this...