diff --git a/email-verification-for-woocommerce.php b/email-verification-for-woocommerce.php index 2162867..decbb72 100644 --- a/email-verification-for-woocommerce.php +++ b/email-verification-for-woocommerce.php @@ -3,13 +3,13 @@ Plugin Name: Email Verification for WooCommerce Plugin URI: https://wpfactory.com/item/email-verification-for-woocommerce/ Description: Verify user emails in WooCommerce. Beautifully. -Version: 2.2.7 +Version: 2.2.8 Author: WPFactory Author URI: https://wpfactory.com Text Domain: emails-verification-for-woocommerce Domain Path: /langs Copyright: © 2022 WPFactory -WC tested up to: 6.1 +WC tested up to: 6.2 License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html */ @@ -62,7 +62,7 @@ final class Alg_WC_Email_Verification { * @var string * @since 1.0.0 */ - public $version = '2.2.7'; + public $version = '2.2.8'; /** * @var Alg_WC_Email_Verification The single instance of the class diff --git a/includes/class-alg-wc-ev-core.php b/includes/class-alg-wc-ev-core.php index 3e59a8e..b7903f1 100644 --- a/includes/class-alg-wc-ev-core.php +++ b/includes/class-alg-wc-ev-core.php @@ -2,7 +2,7 @@ /** * Email Verification for WooCommerce - Core Class * - * @version 2.2.6 + * @version 2.2.8 * @since 1.0.0 * @author WPFactory */ @@ -337,11 +337,33 @@ function output_success_activation_message() { /** * redirect_on_success_activation. * - * @version 2.2.6 + * @version 2.2.8 * @since 2.0.0 * */ function redirect_on_success_activation( $user_id, $args ) { + if ( false !== ( $redirect_url = $this->get_redirect_url_on_success_activation( $args ) ) ) { + $redirect_url = add_query_arg( array( 'alg_wc_ev_success_activation_message' => 1 ), $redirect_url ); + wp_redirect( $redirect_url ); + exit; + } + } + + /** + * get_redirect_url_on_success_activation. + * + * @version 2.2.8 + * @since 2.2.8 + * + * @param null $args + * + * @return bool|string + */ + function get_redirect_url_on_success_activation( $args = null ) { + $args = wp_parse_args( $args, array( + 'directly' => true + ) ); + $redirect_url = false; if ( 'no' !== ( $redirect = get_option( 'alg_wc_ev_redirect_to_my_account_on_success', 'yes' ) ) && $args['directly'] @@ -360,9 +382,8 @@ function redirect_on_success_activation( $user_id, $args ) { $redirect_url = wc_get_page_permalink( 'myaccount' ); } $redirect_url = add_query_arg( array( 'alg_wc_ev_success_activation_message' => 1 ), $redirect_url ); - wp_redirect( $redirect_url ); - exit; } + return $redirect_url; } /** diff --git a/includes/class-alg-wc-ev-logouts.php b/includes/class-alg-wc-ev-logouts.php index cd8eaf8..751f539 100644 --- a/includes/class-alg-wc-ev-logouts.php +++ b/includes/class-alg-wc-ev-logouts.php @@ -2,7 +2,7 @@ /** * Email Verification for WooCommerce - Logouts Class * - * @version 2.2.6 + * @version 2.2.8 * @since 1.6.0 * @author WPFactory */ @@ -202,7 +202,7 @@ function logout_and_redirect_user_myaccount() { /** * block_unverified_user_login. * - * @version 2.1.5 + * @version 2.2.8 * @since 1.0.0 * * @param $user @@ -225,7 +225,11 @@ function block_unverified_user_login( $user ) { ! alg_wc_ev()->core->is_user_verified( $check_user ) ) { $error_msg = apply_filters( 'alg_wc_ev_block_unverified_user_login_error_message', alg_wc_ev()->core->messages->get_error_message( $check_user->ID ), $check_user ); - $user = new WP_Error( 'alg_wc_ev_email_verified_error', $error_msg ); + if ( is_a( $user, 'WP_User' ) ) { + $user = new WP_Error( 'alg_wc_ev_email_verified_error', $error_msg ); + } elseif ( is_wp_error( $user ) ) { + $user->add( 'alg_wc_ev_email_verified_error', $error_msg ); + } } } return $user; diff --git a/includes/settings/class-alg-wc-ev-settings-admin.php b/includes/settings/class-alg-wc-ev-settings-admin.php index cd0d6eb..016797a 100644 --- a/includes/settings/class-alg-wc-ev-settings-admin.php +++ b/includes/settings/class-alg-wc-ev-settings-admin.php @@ -2,7 +2,7 @@ /** * Email Verification for WooCommerce - Admin Section Settings * - * @version 2.2.0 + * @version 2.2.8 * @since 1.3.0 * @author WPFactory */ @@ -44,7 +44,7 @@ function get_allowed_user_roles_option() { /** * get_settings. * - * @version 2.2.0 + * @version 2.2.8 * @since 1.3.0 * @todo [next] Delete users (automatically): better description * @todo [next] Email: better description(s) and default value(s) @@ -60,9 +60,9 @@ function get_settings() { 'id' => 'alg_wc_ev_admin_options', ), array( - 'title' => __( 'Allowed user roles', 'cost-of-goods-for-woocommerce' ), - 'desc' => __( 'User roles allowed to see and interact with the admin interface from the Email Verification plugin.', 'cost-of-goods-for-woocommerce' ), - 'desc_tip' => __( 'The administrator can\'t be removed', 'cost-of-goods-for-woocommerce' ), + 'title' => __( 'Allowed user roles', 'emails-verification-for-woocommerce' ), + 'desc' => __( 'User roles allowed to see and interact with the admin interface from the Email Verification plugin.', 'emails-verification-for-woocommerce' ), + 'desc_tip' => __( 'The administrator can\'t be removed', 'emails-verification-for-woocommerce' ), 'id' => 'alg_wc_ev_admin_allowed_user_roles', 'default' => array( 'administrator' ), 'type' => 'multiselect', diff --git a/includes/settings/class-alg-wc-ev-settings-compatibility.php b/includes/settings/class-alg-wc-ev-settings-compatibility.php index 1f753aa..c68fc45 100644 --- a/includes/settings/class-alg-wc-ev-settings-compatibility.php +++ b/includes/settings/class-alg-wc-ev-settings-compatibility.php @@ -2,7 +2,7 @@ /** * Email Verification for WooCommerce - Compatibility Section Settings. * - * @version 2.2.7 + * @version 2.2.8 * @since 2.1.3 * @author WPFactory */ @@ -28,7 +28,7 @@ function __construct() { /** * get_settings. * - * @version 2.2.7 + * @version 2.2.8 * @since 2.1.3 * @todo (maybe) remove `alg_wc_ev_prevent_login_after_checkout_notice` (i.e. make it always enabled) */ @@ -133,8 +133,30 @@ function get_settings() { 'id' => 'alg_wc_ev_compatibility_email_customizer_options', ), ); + $elementor_essential_addons_opts = array( + array( + 'title' => __( 'Essential Addons for Elementor', 'emails-verification-for-woocommerce' ), + 'type' => 'title', + 'desc' => sprintf( __( 'Compatibility with %s plugin.', 'emails-verification-for-woocommerce' ), sprintf( '%s', 'https://essential-addons.com/elementor/', __( __( 'Essential Addons for Elementor', 'emails-verification-for-woocommerce' ), 'emails-verification-for-woocommerce' ) ) ), + 'id' => 'alg_wc_ev_compatibility_elementor_ea_options', + ), + array( + 'title' => __( 'Login Register form', 'emails-verification-for-woocommerce' ), + 'desc' => sprintf( __( 'Verify users who register or log in from %s element', 'emails-verification-for-woocommerce' ), '' . __( 'Login Register form', 'emails-verification-for-woocommerce' ) . '' ), + 'desc_tip' => sprintf( __( 'If you have issues, try to enable %s and set the %s option as %s.', 'emails-verification-for-woocommerce' ), '' . __( 'General > Account verification > Verify account for current users', 'emails-verification-for-woocommerce' ) . '',''.__( 'Advanced > Authenticate filter', 'emails-verification-for-woocommerce' ) . '', ''.__( 'Authenticate', 'emails-verification-for-woocommerce' ) . '' ) . '
' . + $this->separate_email_option_msg( 'enabled' ), + 'id' => 'alg_wc_ev_compatibility_elementor_ea_login_register_form', + 'default' => 'no', + 'type' => 'checkbox', + 'custom_attributes' => apply_filters( 'alg_wc_ev_settings', array( 'disabled' => 'disabled' ) ), + ), + array( + 'type' => 'sectionend', + 'id' => 'alg_wc_ev_compatibility_elementor_ea_options', + ), + ); return array_merge( - $general, $email_customizer_themehigh_opts + $general, $elementor_essential_addons_opts, $email_customizer_themehigh_opts ); } diff --git a/langs/emails-verification-for-woocommerce.pot b/langs/emails-verification-for-woocommerce.pot index 19768bf..afcbb25 100644 --- a/langs/emails-verification-for-woocommerce.pot +++ b/langs/emails-verification-for-woocommerce.pot @@ -2,14 +2,14 @@ # This file is distributed under the GNU General Public License v3.0. msgid "" msgstr "" -"Project-Id-Version: Email Verification for WooCommerce 2.2.7\n" +"Project-Id-Version: Email Verification for WooCommerce 2.2.8\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/emails-verification-for-woocommerce\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-01-31T19:20:02+01:00\n" +"POT-Creation-Date: 2022-03-02T15:37:15+01:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.4.0\n" "X-Domain: emails-verification-for-woocommerce\n" @@ -83,7 +83,7 @@ msgid "User %s: activation link resent." msgstr "" #: includes/class-alg-wc-ev-admin.php:432 -#: includes/class-alg-wc-ev-core.php:685 +#: includes/class-alg-wc-ev-core.php:706 msgid "Verified" msgstr "" @@ -124,15 +124,15 @@ msgid "You can resend the email with verification link by clicking here." msgstr "" -#: includes/class-alg-wc-ev-core.php:686 +#: includes/class-alg-wc-ev-core.php:707 msgid "Unverified" msgstr "" @@ -209,6 +209,18 @@ msgstr "" msgid "Admin options" msgstr "" +#: includes/settings/class-alg-wc-ev-settings-admin.php:63 +msgid "Allowed user roles" +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-admin.php:64 +msgid "User roles allowed to see and interact with the admin interface from the Email Verification plugin." +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-admin.php:65 +msgid "The administrator can't be removed" +msgstr "" + #: includes/settings/class-alg-wc-ev-settings-admin.php:78 #: includes/settings/class-alg-wc-ev-settings-admin.php:84 #: includes/settings/class-alg-wc-ev-settings-admin.php:99 @@ -857,6 +869,7 @@ msgid "Advanced > Block auth cookies" msgstr "" #: includes/settings/class-alg-wc-ev-settings-compatibility.php:43 +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:146 msgid "Advanced > Authenticate filter" msgstr "" @@ -958,6 +971,7 @@ msgid "Email Customizer for WooCommerce" msgstr "" #: includes/settings/class-alg-wc-ev-settings-compatibility.php:117 +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:140 msgid "Compatibility with %s plugin." msgstr "" @@ -977,6 +991,32 @@ msgstr "" msgid "Custom Hook" msgstr "" +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:138 +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:140 +msgid "Essential Addons for Elementor" +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:144 +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:145 +msgid "Login Register form" +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:145 +msgid "Verify users who register or log in from %s element" +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:146 +msgid "If you have issues, try to enable %s and set the %s option as %s." +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:146 +msgid "General > Account verification > Verify account for current users" +msgstr "" + +#: includes/settings/class-alg-wc-ev-settings-compatibility.php:146 +msgid "Authenticate" +msgstr "" + #: includes/settings/class-alg-wc-ev-settings-email.php:24 #: includes/settings/class-alg-wc-ev-settings-section.php:104 msgid "Email" diff --git a/readme.txt b/readme.txt index 4f892f6..ba38b00 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: wpcodefactory, Karzin Tags: woocommerce, email, verification, email verification, woo commerce Requires at least: 4.4 Tested up to: 5.9 -Stable tag: 2.2.7 +Stable tag: 2.2.8 License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -201,6 +201,11 @@ Params for the `[alg_wc_ev_email_content_placeholder]` shortcode: == Changelog == += 2.2.8 - 02/03/2022 = +* Dev - Improve `Alg_WC_Email_Verification_Logouts::block_unverified_user_login()`. +* Dev - Compatibility - Essential Addons for Elementor - Add option to Verify users who register or log in from Login Register form element. +* WC tested up to: 6.2. + = 2.2.7 - 31/01/2022 = * Dev - Compatibility - Email Customizer - Create option that allows a `alg_wc_ev_ec_email_content` action hook display the activation email content. * Dev - Add more strings to `wpml-config.xml`.