Skip to content

Commit

Permalink
v2.7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed May 6, 2024
1 parent b3115d9 commit 9cfe842
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 176 deletions.
4 changes: 2 additions & 2 deletions email-verification-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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.7.7
Version: 2.7.8
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: emails-verification-for-woocommerce
Expand Down Expand Up @@ -62,7 +62,7 @@ final class Alg_WC_Email_Verification {
* @var string
* @since 1.0.0
*/
public $version = '2.7.7';
public $version = '2.7.8';

/**
* @var Alg_WC_Email_Verification The single instance of the class
Expand Down
40 changes: 30 additions & 10 deletions includes/class-alg-wc-ev-messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Messages Class.
*
* @version 2.4.3
* @version 2.7.8
* @since 1.6.0
* @author WPFactory
*/
Expand All @@ -26,13 +26,18 @@ function __construct() {
/**
* get_error_message.
*
* @version 2.0.7
* @version 2.7.8
* @since 1.6.0
*/
function get_error_message( $user_id ) {
$notice = do_shortcode( get_option( 'alg_wc_ev_error_message',
$notice = do_shortcode( get_option( 'alg_wc_ev_error_message',
__( 'Your account has to be activated before you can login. You can resend the email with verification link by clicking <a href="%resend_verification_url%">here</a>.', 'emails-verification-for-woocommerce' ) ) );
return str_replace( '%resend_verification_url%', esc_url( $this->get_resend_verification_url( $user_id ) ), $notice );
$placeholders = array(
'%resend_verification_url%' => esc_url( $this->get_resend_verification_url( $user_id ) )
);
$placeholders = array_merge( $placeholders, alg_wc_ev_get_user_placeholders( array( 'user_id' => $user_id ) ) );

return str_replace( array_keys( $placeholders ), $placeholders, $notice );
}

/**
Expand Down Expand Up @@ -68,13 +73,18 @@ function get_resend_message( $code = '1' ) {
/**
* get_failed_message.
*
* @version 2.0.7
* @version 2.7.8
* @since 1.6.0
*/
function get_failed_message( $user_id ) {
$notice = do_shortcode( get_option( 'alg_wc_ev_failed_message',
__( '<strong>Error:</strong> Activation failed, please contact our administrator. You can resend the email with verification link by clicking <a href="%resend_verification_url%">here</a>.', 'emails-verification-for-woocommerce' ) ) );
return str_replace( '%resend_verification_url%', esc_url( $this->get_resend_verification_url( $user_id ) ), $notice );
$placeholders = array(
'%resend_verification_url%' => esc_url( $this->get_resend_verification_url( $user_id ) )
);
$placeholders = array_merge( $placeholders, alg_wc_ev_get_user_placeholders( array( 'user_id' => $user_id ) ) );

return str_replace( array_keys( $placeholders ), $placeholders, $notice );
}

/**
Expand All @@ -91,25 +101,35 @@ function get_success_message() {
/**
* get_activation_message.
*
* @version 2.0.7
* @version 2.7.8
* @since 1.5.0
*/
function get_activation_message( $user_id ) {
$notice = do_shortcode( get_option( 'alg_wc_ev_activation_message',
__( 'Thank you for your registration. Your account has to be activated before you can login. Please check your email.', 'emails-verification-for-woocommerce' ) ) );
return str_replace( '%resend_verification_url%', esc_url( $this->get_resend_verification_url( $user_id ) ), $notice );
$placeholders = array(
'%resend_verification_url%' => esc_url( $this->get_resend_verification_url( $user_id ) )
);
$placeholders = array_merge( $placeholders, alg_wc_ev_get_user_placeholders( array( 'user_id' => $user_id ) ) );

return str_replace( array_keys( $placeholders ), $placeholders, $notice );
}

/**
* get_activation_message.
*
* @version 2.4.3
* @version 2.7.8
* @since 2.4.3
*/
function get_already_verified_message( $user_id ) {
$notice = do_shortcode( get_option( 'alg_wc_ev_already_verified_message',
__( 'Your account is already verified.', 'emails-verification-for-woocommerce' ) ) );
return $notice;
$placeholders = array(
'%resend_verification_url%' => esc_url( $this->get_resend_verification_url( $user_id ) )
);
$placeholders = array_merge( $placeholders, alg_wc_ev_get_user_placeholders( array( 'user_id' => $user_id ) ) );

return str_replace( array_keys( $placeholders ), $placeholders, $notice );
}

/**
Expand Down
32 changes: 4 additions & 28 deletions includes/settings/class-alg-wc-ev-settings-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Email Section Settings.
*
* @version 2.6.7
* @version 2.7.8
* @since 1.3.0
* @author WPFactory
*/
Expand All @@ -25,36 +25,12 @@ function __construct() {
parent::__construct();
}

/**
* get_default_email_placeholders.
*
* @version 1.9.7
* @since 1.9.7
*
* @return array
*/
function get_default_email_placeholders(){
return array(
'%site_title%',
'%site_url%',
'%user_id%',
'%user_login%',
'%user_nicename%',
'%user_email%',
'%user_url%',
'%user_registered%',
'%user_display_name%',
'%user_roles%',
'%user_first_name%',
'%user_last_name%',
'%admin_user_profile_url%',
);
}


/**
* get_settings.
*
* @version 2.6.7
* @version 2.7.8
* @since 1.3.0
*/
function get_settings() {
Expand Down Expand Up @@ -135,7 +111,7 @@ function get_settings() {
$email_placeholder_opts = array(
array(
'title' => __( 'Common placeholders', 'emails-verification-for-woocommerce' ),
'desc' => sprintf( __( 'These placeholders can be used on the Email Subject or Content options: %s.', 'emails-verification-for-woocommerce' ), '<code>' . implode( '</code>, <code>', $this->get_default_email_placeholders() ) . '</code>' ).' '.
'desc' => sprintf( __( 'These placeholders can be used on the Email Subject or Content options: %s.', 'emails-verification-for-woocommerce' ), '<code>' . implode( '</code>, <code>', $this->get_default_email_placeholders() ) . '</code>' ) . ' ' .
sprintf( __( 'If you\'re having deliverability problems or emails being sent to Spam, try using the placeholders %s and %s on the Email Content or subject.', 'emails-verification-for-woocommerce' ), '<code>%site_title%</code>','<code>%site_url%</code>'),

'type' => 'title',
Expand Down
11 changes: 6 additions & 5 deletions includes/settings/class-alg-wc-ev-settings-messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Messages Section Settings.
*
* @version 2.4.3
* @version 2.7.8
* @since 1.3.0
* @author WPFactory
*/
Expand All @@ -28,7 +28,7 @@ function __construct() {
/**
* get_settings.
*
* @version 2.4.3
* @version 2.7.8
* @since 1.3.0
*/
function get_settings() {
Expand Down Expand Up @@ -66,7 +66,7 @@ function get_settings() {
),
array(
'title' => __( 'Error', 'emails-verification-for-woocommerce' ),
'desc' => $this->available_placeholders_desc( array( '%resend_verification_url%' ) ),
'desc' => $this->available_placeholders_desc( array_merge( array( '%resend_verification_url%' ), $this->get_default_user_placeholders() ) ),
'type' => 'textarea',
'id' => 'alg_wc_ev_error_message',
'default' => __( 'Your account has to be activated before you can login. You can resend the email with verification link by clicking <a href="%resend_verification_url%">here</a>.', 'emails-verification-for-woocommerce' ),
Expand All @@ -75,7 +75,7 @@ function get_settings() {
),
array(
'title' => __( 'Failed', 'emails-verification-for-woocommerce' ),
'desc' => $this->available_placeholders_desc( array( '%resend_verification_url%' ) ),
'desc' => $this->available_placeholders_desc( array_merge( array( '%resend_verification_url%' ), $this->get_default_user_placeholders() ) ),
'type' => 'textarea',
'id' => 'alg_wc_ev_failed_message',
'default' => __( '<strong>Error:</strong> Activation failed, please contact our administrator. You can resend the email with verification link by clicking <a href="%resend_verification_url%">here</a>.', 'emails-verification-for-woocommerce' ),
Expand All @@ -84,6 +84,7 @@ function get_settings() {
),
array(
'title' => __( 'Already verified', 'emails-verification-for-woocommerce' ),
'desc' => $this->available_placeholders_desc( $this->get_default_user_placeholders() ),
'type' => 'textarea',
'id' => 'alg_wc_ev_already_verified_message',
'default' => __( 'Your account is already verified.', 'emails-verification-for-woocommerce' ),
Expand All @@ -92,7 +93,7 @@ function get_settings() {
),
array(
'title' => __( 'Activate', 'emails-verification-for-woocommerce' ),
'desc' => $this->available_placeholders_desc( array( '%resend_verification_url%' ) ),
'desc' => $this->available_placeholders_desc( array_merge( array( '%resend_verification_url%' ), $this->get_default_user_placeholders() ) ),
'type' => 'textarea',
'id' => 'alg_wc_ev_activation_message',
'default' => __( 'Thank you for your registration. Your account has to be activated before you can login. Please check your email.', 'emails-verification-for-woocommerce' ),
Expand Down
40 changes: 39 additions & 1 deletion includes/settings/class-alg-wc-ev-settings-section.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Section Settings.
*
* @version 2.7.1
* @version 2.7.8
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -38,6 +38,44 @@ function __construct() {
add_filter( 'woocommerce_get_settings_alg_wc_ev_' . $this->id, array( $this, 'get_settings' ), PHP_INT_MAX );
}

/**
* get_default_user_id_placeholders.
*
* @version 2.7.8
* @since 2.7.8
*
* @return array
*/
function get_default_user_placeholders(){
return array(
'%user_login%',
'%user_nicename%',
'%user_email%',
'%user_url%',
'%user_registered%',
'%user_display_name%',
'%user_roles%',
'%user_first_name%',
'%user_last_name%',
'%admin_user_profile_url%',
);
}

/**
* get_default_user_id_placeholders.
*
* @version 2.7.8
* @since 1.9.7
*
* @return array
*/
function get_default_email_placeholders() {
return array_merge( $this->get_default_user_placeholders(), array(
'%site_title%',
'%site_url%',
) );
}

/**
* @version 2.1.1
* @since 2.1.1
Expand Down
Loading

0 comments on commit 9cfe842

Please sign in to comment.