diff --git a/includes/admin/core/class-admin-users.php b/includes/admin/core/class-admin-users.php index 5bd014b6..b2f034ce 100644 --- a/includes/admin/core/class-admin-users.php +++ b/includes/admin/core/class-admin-users.php @@ -74,8 +74,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) { case 'um_approve_membership': case 'um_reenable': - add_filter( 'um_template_tags_patterns_hook', 'password_reset_link_tags_patterns', 10, 1 ); - add_filter( 'um_template_tags_replaces_hook', 'password_reset_link_tags_replaces', 10, 1 ); + add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 ); + add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 ); UM()->user()->approve(); break; diff --git a/includes/core/class-form.php b/includes/core/class-form.php index ee8aef77..dab22482 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -504,7 +504,7 @@ if ( ! class_exists( 'um\core\Form' ) ) { * @param integer $post_id * @return string */ - function form_type( $post_id ){ + function form_type( $post_id ) { $mode = get_post_meta( $post_id, '_um_mode', true ); return $mode; } diff --git a/includes/core/class-modal.php b/includes/core/class-modal.php index 543a3e14..edc9c03e 100644 --- a/includes/core/class-modal.php +++ b/includes/core/class-modal.php @@ -1,14 +1,17 @@ password(), 'add_placeholder' ), 10, 1 ); + add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 ); + UM()->mail()->send( um_user('user_email'), 'resetpw_email' ); } diff --git a/includes/core/um-actions-core.php b/includes/core/um-actions-core.php index 79d3eb59..d524e2b8 100644 --- a/includes/core/um-actions-core.php +++ b/includes/core/um-actions-core.php @@ -100,8 +100,8 @@ function um_action_request_process() { wp_die( __( 'You do not have permission to make this action.', 'ultimate-member' ) ); } - add_filter( 'um_template_tags_patterns_hook', 'password_reset_link_tags_patterns', 10, 1 ); - add_filter( 'um_template_tags_replaces_hook', 'password_reset_link_tags_replaces', 10, 1 ); + add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 ); + add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 ); um_fetch_user( $uid ); UM()->user()->approve(); diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 3a0b3b42..46e69dce 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -614,14 +614,14 @@ function um_submit_form_errors_hook_( $args ) { case 'unique_username': - if ( $args[$key] == '' ) { - UM()->form()->add_error($key, __('You must provide a username','ultimate-member') ); - } else if ( $mode == 'register' && username_exists( sanitize_user( $args[$key] ) ) ) { - UM()->form()->add_error($key, __('Your username is already taken','ultimate-member') ); - } else if ( is_email( $args[$key] ) ) { - UM()->form()->add_error($key, __('Username cannot be an email','ultimate-member') ); - } else if ( ! UM()->validation()->safe_username( $args[$key] ) ) { - UM()->form()->add_error($key, __('Your username contains invalid characters','ultimate-member') ); + if ( $args[ $key ] == '' ) { + UM()->form()->add_error( $key, __( 'You must provide a username', 'ultimate-member' ) ); + } elseif ( $mode == 'register' && username_exists( sanitize_user( $args[ $key ] ) ) ) { + UM()->form()->add_error( $key, __( 'Your username is already taken', 'ultimate-member' ) ); + } elseif ( is_email( $args[ $key ] ) ) { + UM()->form()->add_error( $key, __( 'Username cannot be an email', 'ultimate-member' ) ); + } elseif ( ! UM()->validation()->safe_username( $args[$key] ) ) { + UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) ); } break; diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 28f4e228..62a17681 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -220,30 +220,6 @@ function um_convert_tags( $content, $args = array(), $with_kses = true ) { return $content; } -/** - * UM Placeholders for reset password - * - * @param $placeholders - * - * @return array - */ -function password_reset_link_tags_patterns( $placeholders ) { - $placeholders[] = '{password_reset_link}'; - return $placeholders; -} - -/** - * UM Replace Placeholders for reset password - * - * @param $replace_placeholders - * - * @return array - */ -function password_reset_link_tags_replaces( $replace_placeholders ) { - $replace_placeholders[] = um_user( 'password_reset_link' ); - return $replace_placeholders; -} - /** * @function um_user_ip()