From 9374b7e2cb710e031a1a8d0e378d82e2d6ffd6de Mon Sep 17 00:00:00 2001 From: andrewshuba Date: Fri, 9 Aug 2019 14:56:27 +0300 Subject: [PATCH] - fix default buttons text - show default button text if filed value is empty --- includes/core/class-query.php | 4 ++-- includes/core/um-actions-login.php | 8 ++++++++ includes/core/um-actions-profile.php | 7 +++++++ includes/core/um-actions-register.php | 8 ++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/includes/core/class-query.php b/includes/core/class-query.php index fd49510d..9000fb43 100644 --- a/includes/core/class-query.php +++ b/includes/core/class-query.php @@ -400,12 +400,12 @@ if ( ! class_exists( 'um\core\Query' ) ) { * @param null $fallback * @return int|mixed|null|string */ - function get_meta_value( $key, $array_key = null, $fallback = null ) { + function get_meta_value( $key, $array_key = null, $fallback = false ) { $post_id = get_the_ID(); $try = get_post_meta( $post_id, $key, true ); //old version if ( ! empty( $try ) ) - if ( false !== $try ) + if ( $try != '' ) if ( is_array( $try ) && in_array( $array_key, $try ) ) { return $array_key; } else if ( is_array( $try ) ) { diff --git a/includes/core/um-actions-login.php b/includes/core/um-actions-login.php index bba2f03b..c5b2ff76 100644 --- a/includes/core/um-actions-login.php +++ b/includes/core/um-actions-login.php @@ -353,6 +353,10 @@ function um_add_submit_button_to_login( $args ) { */ $primary_btn_word = apply_filters('um_login_form_button_one', $args['primary_btn_word'], $args ); + if ( ! isset( $primary_btn_word ) || $primary_btn_word == '' ){ + $primary_btn_word = UM()->options()->get( 'login_primary_btn_word' ); + } + /** * UM hook * @@ -377,6 +381,10 @@ function um_add_submit_button_to_login( $args ) { */ $secondary_btn_word = apply_filters( 'um_login_form_button_two', $args['secondary_btn_word'], $args ); + if ( ! isset( $secondary_btn_word ) || $secondary_btn_word == '' ){ + $secondary_btn_word = UM()->options()->get( 'login_secondary_btn_word' ); + } + $secondary_btn_url = ! empty( $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page( 'register' ); /** * UM hook diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index 33743fa0..2d1bc649 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -1291,6 +1291,13 @@ function um_add_submit_button_to_profile( $args ) { // only when editing if ( UM()->fields()->editing == false ) { return; + } + + if ( ! isset( $args['primary_btn_word'] ) || $args['primary_btn_word'] == '' ){ + $args['primary_btn_word'] = UM()->options()->get( 'profile_primary_btn_word' ); + } + if ( ! isset( $args['secondary_btn_word'] ) || $args['secondary_btn_word'] == '' ){ + $args['secondary_btn_word'] = UM()->options()->get( 'profile_secondary_btn_word' ); } ?>
diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php index 5f4cdf33..47a5820c 100644 --- a/includes/core/um-actions-register.php +++ b/includes/core/um-actions-register.php @@ -490,6 +490,10 @@ function um_add_submit_button_to_register( $args ) { */ $primary_btn_word = apply_filters('um_register_form_button_one', $primary_btn_word, $args ); + if ( ! isset( $primary_btn_word ) || $primary_btn_word == '' ){ + $primary_btn_word = UM()->options()->get( 'register_primary_btn_word' ); + } + $secondary_btn_word = $args['secondary_btn_word']; /** * UM hook @@ -515,6 +519,10 @@ function um_add_submit_button_to_register( $args ) { */ $secondary_btn_word = apply_filters( 'um_register_form_button_two', $secondary_btn_word, $args ); + if ( ! isset( $secondary_btn_word ) || $secondary_btn_word == '' ){ + $secondary_btn_word = UM()->options()->get( 'register_secondary_btn_word' ); + } + $secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('login'); /** * UM hook