- 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
*/
function ultimatemember_password( $args = array() ) {
public function ultimatemember_password( $args = array() ) {
ob_start();
$defaults = array(
@@ -125,7 +125,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
'max_width' => '450px',
'align' => 'center',
);
$args = wp_parse_args( $args, $defaults );
$args = wp_parse_args( $args, $defaults );
if ( empty( $args['use_custom_settings'] ) ) {
$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
* @title um_reset_password_shortcode_args_filter
* @description Extend Reset Password Arguments
* @input_vars
* [{"var":"$args","type":"array","desc":"Shortcode arguments"}]
* @change_log
* ["Since: 2.0"]
* @usage
* <?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 );
* @since 2.0
* @hook um_reset_password_shortcode_args_filter
*
* @param {array} $args Shortcode arguments.
*
* @return {array} $args Shortcode arguments.
*
* @example <caption>Extend Reset Password Arguments.</caption>
* function my_reset_password_shortcode_args( $args ) {
* // your code here
* 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 );
@@ -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
$args['template'] = 'password-change';
$args['rp_key'] = '';
$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
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';
/**
* @var $mode
* @var $template
*/
extract( $args, EXTR_SKIP );
if ( ! isset( $mode ) && isset( $args['mode'] ) ) {
$mode = $args['mode'];
}
if ( ! isset( $template ) && isset( $args['template'] ) ) {
$template = $args['template'];
}
/**
* UM hook
* Fires pre-load password form shortcode.
*
* @type action
* @title um_pre_{$mode}_shortcode
* @description Action pre-load password form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["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 );
* @since 2.0
* @hook um_pre_{$mode}_shortcode
*
* @param {array} $args Form shortcode pre-loading.
*
* @example <caption>Make any custom action pre-load password form shortcode.</caption>
* function my_pre_password_shortcode( $args ) {
* // your code here
* }
* ?>
* add_action( 'um_pre_{$mode}_shortcode', 'my_pre_password_shortcode', 10, 1 );
*/
do_action( "um_pre_{$mode}_shortcode", $args );
/**
* UM hook
* Fires pre-load password form shortcode.
*
* @type action
* @title um_before_form_is_loaded
* @description Action pre-load password form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_before_form_is_loaded', 'function_name', 10, 1 );
* @example
* <?php
* @since 2.0
* @hook um_before_form_is_loaded
*
* @param {array} $args Form shortcode pre-loading.
*
* @example <caption>Make any custom action pre-load password form shortcode.</caption>
* function my_before_form_is_loaded( $args ) {
* // your code here
* }
* 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
* @title um_before_{$mode}_form_is_loaded
* @description Action pre-load password form shortcode
* @input_vars
* [{"var":"$args","type":"array","desc":"Form shortcode pre-loading"}]
* @change_log
* ["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 );
* @since 2.0
* @hook um_before_{$mode}_form_is_loaded
*
* @param {array} $args Form shortcode pre-loading.
*
* @example <caption>Make any custom action pre-load password form shortcode.</caption>
* function my_before_form_is_loaded( $args ) {
* // 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 );