diff --git a/includes/core/class-account.php b/includes/core/class-account.php
index f8bea1b5..a86b63ef 100644
--- a/includes/core/class-account.php
+++ b/includes/core/class-account.php
@@ -245,69 +245,14 @@ if ( ! class_exists( 'um\core\Account' ) ) {
$this->current_tab = apply_filters( 'um_change_default_tab', $this->current_tab, $args );
- /**
- * UM hook
- *
- * @type action
- * @title um_pre_{$mode}_shortcode
- * @description Make some action before account tabs loading
- * @input_vars
- * [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_pre_{$mode}_shortcode', 'function_name', 10, 1 );
- * @example
- *
- */
+ /** This filter is documented in includes/core/class-shortcodes.php */
do_action( "um_pre_{$args['mode']}_shortcode", $args );
- /**
- * UM hook
- *
- * @type action
- * @title um_before_form_is_loaded
- * @description Make some action before account tabs loading
- * @input_vars
- * [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_before_form_is_loaded', 'function_name', 10, 1 );
- * @example
- *
- */
+ /** This filter is documented in includes/core/class-shortcodes.php */
do_action( 'um_before_form_is_loaded', $args );
- /**
- * UM hook
- *
- * @type action
- * @title um_before_{$mode}_form_is_loaded
- * @description Make some action before account tabs loading
- * @input_vars
- * [{"var":"$args","type":"array","desc":"Account Page Arguments"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_before_{$mode}_form_is_loaded', 'function_name', 10, 1 );
- * @example
- *
- */
+ /** This filter is documented in includes/core/class-shortcodes.php */
do_action( "um_before_{$args['mode']}_form_is_loaded", $args );
UM()->shortcodes()->template_load( $args['template'], $args );
-
}
if ( ! is_admin() && ! defined( 'DOING_AJAX' ) ) {
diff --git a/includes/core/class-password.php b/includes/core/class-password.php
index 594904a0..6e851af3 100644
--- a/includes/core/class-password.php
+++ b/includes/core/class-password.php
@@ -1,37 +1,35 @@
'password-reset',
- 'mode' => 'password',
- 'form_id' => 'um_password_id',
- 'max_width' => '450px',
- 'align' => 'center',
+ /** There is possible to use 'shortcode_atts_ultimatemember_password' filter for getting customized $atts. This filter is documented in wp-includes/shortcodes.php "shortcode_atts_{$shortcode}" */
+ $args = shortcode_atts(
+ array(
+ 'template' => 'password-reset',
+ 'mode' => 'password',
+ 'form_id' => 'um_password_id',
+ 'max_width' => '450px',
+ 'align' => 'center',
+ ),
+ $args,
+ 'ultimatemember_password'
);
- $args = wp_parse_args( $args, $defaults );
if ( empty( $args['use_custom_settings'] ) ) {
$args = array_merge( $args, UM()->shortcodes()->get_css_args( $args ) );
} else {
$args = array_merge( UM()->shortcodes()->get_css_args( $args ), $args );
}
-
/**
* Filters extend Reset Password Arguments
*
- * @since 2.0
+ * @since 1.3.x
* @hook um_reset_password_shortcode_args_filter
*
- * @param {array} $args Shortcode arguments.
+ * @param {array} $args Shortcode arguments.
*
- * @return {array} $args Shortcode arguments.
+ * @return {array} Shortcode arguments.
*
* @example
Extend Reset Password Arguments.
* function my_reset_password_shortcode_args( $args ) {
@@ -152,7 +150,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
*/
$args = apply_filters( 'um_reset_password_shortcode_args_filter', $args );
- if ( isset( $this->change_password ) ) {
+ if ( false !== $this->change_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'] = '';
@@ -165,74 +163,30 @@ if ( ! class_exists( 'um\core\Password' ) ) {
}
}
- UM()->fields()->set_id = 'um_password_id';
-
- if ( ! isset( $mode ) && isset( $args['mode'] ) ) {
- $mode = $args['mode'];
- }
- if ( ! isset( $template ) && isset( $args['template'] ) ) {
- $template = $args['template'];
+ if ( empty( $args['mode'] ) || empty( $args['template'] ) ) {
+ return '';
}
- /**
- * Fires pre-load password form shortcode.
- *
- * @since 2.0
- * @hook um_pre_{$mode}_shortcode
- *
- * @param {array} $args Form shortcode pre-loading.
- *
- * @example Make any custom action pre-load password form shortcode.
- * 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()->fields()->set_id = $args['form_id'];
- /**
- * Fires pre-load password form shortcode.
- *
- * @since 2.0
- * @hook um_before_form_is_loaded
- *
- * @param {array} $args Form shortcode pre-loading.
- *
- * @example Make any custom action pre-load password form shortcode.
- * function my_before_form_is_loaded( $args ) {
- * // your code here
- * }
- * add_action( 'um_before_form_is_loaded', 'my_before_form_is_loaded', 10, 1 );
- */
+ ob_start();
+
+ /** This filter is documented in includes/core/class-shortcodes.php */
+ do_action( "um_pre_{$args['mode']}_shortcode", $args );
+ /** This filter is documented in includes/core/class-shortcodes.php */
do_action( 'um_before_form_is_loaded', $args );
+ /** This filter is documented in includes/core/class-shortcodes.php */
+ do_action( "um_before_{$args['mode']}_form_is_loaded", $args );
- /**
- * Fires pre-load password form shortcode.
- *
- * @since 2.0
- * @hook um_before_{$mode}_form_is_loaded
- *
- * @param {array} $args Form shortcode pre-loading.
- *
- * @example Make any custom action pre-load password form shortcode.
- * 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 );
-
- UM()->shortcodes()->template_load( $template, $args );
+ UM()->shortcodes()->template_load( $args['template'], $args );
if ( ! is_admin() && ! defined( 'DOING_AJAX' ) ) {
UM()->shortcodes()->dynamic_css( $args );
}
- $output = ob_get_clean();
- return $output;
+ return ob_get_clean();
}
-
/**
* Check if a legitimate password reset request is in action
*
diff --git a/includes/core/class-shortcodes.php b/includes/core/class-shortcodes.php
index 802ec4ff..236192ae 100644
--- a/includes/core/class-shortcodes.php
+++ b/includes/core/class-shortcodes.php
@@ -757,50 +757,65 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
}
/**
- * Fires pre-load form shortcode.
+ * Fires before loading form shortcode.
*
- * @since 2.0
+ * Note: $mode can be 'profile', 'login', 'register', 'account'.
+ *
+ * @since 1.3.x
* @hook um_pre_{$mode}_shortcode
*
- * @param {array} $args Form shortcode pre-loading.
+ * @param {array} $args Form shortcode arguments.
*
- * @example Make any custom action on pre-load form shortcode.
- * function my_pre_shortcode( $args ) {
+ * @example Make any custom action before loading a registration form shortcode.
+ * function my_pre_register_shortcode( $args ) {
* // your code here
* }
- * add_action( 'um_pre_{$mode}_shortcode', 'my_pre_shortcode', 10, 1 );
+ * add_action( 'um_pre_register_shortcode', 'my_pre_register_shortcode' );
+ * @example Make any custom action before loading a login form shortcode.
+ * function my_pre_login_shortcode( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_pre_login_shortcode', 'my_pre_login_shortcode' );
+ * @example Make any custom action before loading a password reset form shortcode.
+ * function my_pre_password_shortcode( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_pre_password_shortcode', 'my_pre_password_shortcode' );
+ * @example Make any custom action before loading a profile form shortcode.
+ * function my_pre_profile_shortcode( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_pre_profile_shortcode', 'my_pre_profile_shortcode' );
+ * @example Make any custom action before loading an account form shortcode.
+ * function my_pre_account_shortcode( $args ) {
+ * // your code here
+ * }
+ * add_action( 'um_pre_account_shortcode', 'my_pre_account_shortcode' );
*/
do_action( "um_pre_{$mode}_shortcode", $args );
-
/**
- * Fires pre-load form shortcode.
+ * Fires before loading form shortcode.
*
- * @since 2.0
+ * @since 1.3.x
* @hook um_before_form_is_loaded
*
- * @param {array} $args Form shortcode pre-loading.
+ * @param {array} $args Form shortcode arguments.
*
- * @example Make any custom action on pre-load form shortcode.
+ * @example Make any custom action before loading UM form shortcode.
* function my_pre_shortcode( $args ) {
* // your code here
* }
* add_action( 'um_before_form_is_loaded', 'my_pre_shortcode', 10, 1 );
*/
do_action( 'um_before_form_is_loaded', $args );
-
/**
- * Fires pre-load form shortcode.
+ * Fires before loading a form shortcode.
*
- * @since 2.0
+ * @since 1.3.x
+ * @todo Deprecate since 2.7.0. Use `um_pre_{$mode}_shortcode` or `um_before_form_is_loaded` instead.
* @hook um_before_{$mode}_form_is_loaded
*
- * @param {array} $args Form shortcode pre-loading.
- *
- * @example Make any custom action on pre-load form shortcode.
- * function my_pre_shortcode( $args ) {
- * // your code here
- * }
- * add_action( 'um_before_{$mode}_form_is_loaded', 'my_pre_shortcode', 10, 1 );
+ * @param {array} $args Form shortcode arguments.
*/
do_action( "um_before_{$mode}_form_is_loaded", $args );
@@ -808,7 +823,7 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
$this->dynamic_css( $args );
- if ( um_get_requested_user() || 'logout' === $mode ) {
+ if ( 'logout' === $mode || um_get_requested_user() ) {
um_reset_user();
}
@@ -828,11 +843,9 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
*/
do_action( 'um_after_everything_output' );
- $output = ob_get_clean();
- return $output;
+ return ob_get_clean();
}
-
/**
* Get dynamic CSS args
*