mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-20 07:04:06 +09:00
- fixed updating display_name if there is set the User Display Name setting to Default WP Display Name in UM > General > Users > Display name;
- fixed typo in the password validation
This commit is contained in:
@@ -88,11 +88,11 @@ function um_submit_account_errors_hook( $args ) {
|
||||
$max_length = ! empty( $max_length ) ? $max_length : 30;
|
||||
|
||||
if ( mb_strlen( $args['user_password'] ) < $min_length ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 8 characters', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( 'user_password', sprintf( __( 'Your password must contain at least %d characters', 'ultimate-member' ), $min_length ) );
|
||||
}
|
||||
|
||||
if ( mb_strlen( $args['user_password'] ) > $max_length ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 30 characters', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( 'user_password', sprintf( __( 'Your password must contain less than %d characters', 'ultimate-member' ), $max_length ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->validation()->strong_pass( $args['user_password'] ) ) {
|
||||
@@ -375,8 +375,24 @@ function um_submit_account_details( $args ) {
|
||||
*/
|
||||
do_action( 'um_account_pre_update_profile', $changes, $user_id );
|
||||
|
||||
UM()->user()->update_profile( $changes );
|
||||
if ( isset( $changes['first_name'] ) || isset( $changes['last_name'] ) || isset( $changes['nickname'] ) ) {
|
||||
$user = get_userdata( $user_id );
|
||||
if ( ! empty( $user ) && ! is_wp_error( $user ) ) {
|
||||
UM()->user()->previous_data['display_name'] = $user->display_name;
|
||||
|
||||
if ( isset( $changes['first_name'] ) ) {
|
||||
UM()->user()->previous_data['first_name'] = $user->first_name;
|
||||
}
|
||||
if ( isset( $changes['last_name'] ) ) {
|
||||
UM()->user()->previous_data['last_name'] = $user->last_name;
|
||||
}
|
||||
if ( isset( $changes['nickname'] ) ) {
|
||||
UM()->user()->previous_data['nickname'] = $user->nickname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM()->user()->update_profile( $changes );
|
||||
|
||||
if ( UM()->account()->is_secure_enabled() ) {
|
||||
update_user_meta( $user_id, 'um_account_secure_fields', array() );
|
||||
@@ -502,7 +518,7 @@ add_action( 'um_before_account_notifications', 'um_before_account_notifications'
|
||||
* @param array $changes An array of fields values.
|
||||
*/
|
||||
function um_after_user_account_updated_permalink( $user_id, $changes ) {
|
||||
if ( isset( $changes['first_name'] ) && isset( $changes['last_name'] ) ) {
|
||||
if ( isset( $changes['first_name'] ) || isset( $changes['last_name'] ) ) {
|
||||
do_action( 'um_update_profile_full_name', $user_id, $changes );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user