- fix ultimatemember_password()

This commit is contained in:
ashubawork
2023-06-22 12:50:44 +03:00
parent 5a2a23802d
commit 709625545e
+48 -64
View File
@@ -115,7 +115,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
* *
* @return string * @return string
*/ */
function ultimatemember_password( $args = array() ) { public function ultimatemember_password( $args = array() ) {
ob_start(); ob_start();
$defaults = array( $defaults = array(
@@ -125,7 +125,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
'max_width' => '450px', 'max_width' => '450px',
'align' => 'center', 'align' => 'center',
); );
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
if ( empty( $args['use_custom_settings'] ) ) { if ( empty( $args['use_custom_settings'] ) ) {
$args = array_merge( $args, UM()->shortcodes()->get_css_args( $args ) ); $args = array_merge( $args, UM()->shortcodes()->get_css_args( $args ) );
@@ -134,25 +134,21 @@ if ( ! class_exists( 'um\core\Password' ) ) {
} }
/** /**
* UM hook * Filters extend Reset Password Arguments
* *
* @type filter * @since 2.0
* @title um_reset_password_shortcode_args_filter * @hook um_reset_password_shortcode_args_filter
* @description Extend Reset Password Arguments *
* @input_vars * @param {array} $args Shortcode arguments.
* [{"var":"$args","type":"array","desc":"Shortcode arguments"}] *
* @change_log * @return {array} $args Shortcode arguments.
* ["Since: 2.0"] *
* @usage * @example <caption>Extend Reset Password Arguments.</caption>
* <?php add_filter( 'um_reset_password_shortcode_args_filter', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_reset_password_shortcode_args_filter', 'my_reset_password_shortcode_args', 10, 1 );
* function my_reset_password_shortcode_args( $args ) { * function my_reset_password_shortcode_args( $args ) {
* // your code here * // your code here
* return $args; * return $args;
* } * }
* ?> * add_filter( 'um_reset_password_shortcode_args_filter', 'my_reset_password_shortcode_args', 10, 1 );
*/ */
$args = apply_filters( 'um_reset_password_shortcode_args_filter', $args ); $args = apply_filters( 'um_reset_password_shortcode_args_filter', $args );
@@ -160,7 +156,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
// then COOKIE are valid then get data from them and populate hidden fields for the password reset form // then COOKIE are valid then get data from them and populate hidden fields for the password reset form
$args['template'] = 'password-change'; $args['template'] = 'password-change';
$args['rp_key'] = ''; $args['rp_key'] = '';
$rp_cookie = 'wp-resetpass-' . COOKIEHASH; $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
@@ -171,70 +167,58 @@ if ( ! class_exists( 'um\core\Password' ) ) {
UM()->fields()->set_id = 'um_password_id'; UM()->fields()->set_id = 'um_password_id';
/** if ( ! isset( $mode ) && isset( $args['mode'] ) ) {
* @var $mode $mode = $args['mode'];
* @var $template }
*/ if ( ! isset( $template ) && isset( $args['template'] ) ) {
extract( $args, EXTR_SKIP ); $template = $args['template'];
}
/** /**
* UM hook * Fires pre-load password form shortcode.
* *
* @type action * @since 2.0
* @title um_pre_{$mode}_shortcode * @hook um_pre_{$mode}_shortcode
* @description Action pre-load password form shortcode *
* @input_vars * @param {array} $args Form shortcode pre-loading.
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}] *
* @change_log * @example <caption>Make any custom action pre-load password form shortcode.</caption>
* ["Since: 2.0"]
* @usage add_action( 'um_pre_{$mode}_shortcode', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_pre_{$mode}_shortcode', 'my_pre_password_shortcode', 10, 1 );
* function my_pre_password_shortcode( $args ) { * function my_pre_password_shortcode( $args ) {
* // your code here * // your code here
* } * }
* ?> * add_action( 'um_pre_{$mode}_shortcode', 'my_pre_password_shortcode', 10, 1 );
*/ */
do_action( "um_pre_{$mode}_shortcode", $args ); do_action( "um_pre_{$mode}_shortcode", $args );
/** /**
* UM hook * Fires pre-load password form shortcode.
* *
* @type action * @since 2.0
* @title um_before_form_is_loaded * @hook um_before_form_is_loaded
* @description Action pre-load password form shortcode *
* @input_vars * @param {array} $args Form shortcode pre-loading.
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}] *
* @change_log * @example <caption>Make any custom action pre-load password form shortcode.</caption>
* ["Since: 2.0"] * function my_before_form_is_loaded( $args ) {
* @usage add_action( 'um_before_form_is_loaded', 'function_name', 10, 1 ); * // your code here
* @example * }
* <?php
* add_action( 'um_before_form_is_loaded', 'my_before_form_is_loaded', 10, 1 ); * add_action( 'um_before_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
* function my_before_form_is_loaded( $args ) {
* // your code here
* }
* ?>
*/ */
do_action( "um_before_form_is_loaded", $args ); do_action( 'um_before_form_is_loaded', $args );
/** /**
* UM hook * Fires pre-load password form shortcode.
* *
* @type action * @since 2.0
* @title um_before_{$mode}_form_is_loaded * @hook um_before_{$mode}_form_is_loaded
* @description Action pre-load password form shortcode *
* @input_vars * @param {array} $args Form shortcode pre-loading.
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}] *
* @change_log * @example <caption>Make any custom action pre-load password form shortcode.</caption>
* ["Since: 2.0"]
* @usage add_action( 'um_before_{$mode}_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_before_{$mode}_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
* function my_before_form_is_loaded( $args ) { * function my_before_form_is_loaded( $args ) {
* // your code here * // your code here
* } * }
* ?> * add_action( 'um_before_{$mode}_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
*/ */
do_action( "um_before_{$mode}_form_is_loaded", $args ); do_action( "um_before_{$mode}_form_is_loaded", $args );