• Laszlo

    (@laszloszalvak)


    Hi!

    We are from Nextend Social Login and we had a received some requests to make our plugin compatible with Woocommerce User Email Verification.

    By default Woocommerce User Email Verification prevented the login with Nextend Social Login as well.

    We made a fix for this problem and we also needed to remove the action that sends the email verification when the user connects with a provider like Facebook, Google etc…

    The problem is that, there is an issue with the singleton pattern of the class XLWUEV_Woocommerce_Confirmation_Email_Public in wp-content/plugins/woo-confirmation-email/public/class-xlwuev-woocommerce-confirmation-email-public.php.

    The description of the issue:
    We are removing the action like:

    remove_action('user_register', array(
                    XLWUEV_Woocommerce_Confirmation_Email_Public::instance(),
                    'custom_form_user_register'
                ), 10);

    However XLWUEV_Woocommerce_Confirmation_Email_Public::instance() creates a new instance every time when it is called, instead of referring to the original one.

    According to the instance function:

    public static function instance() {
    		if ( null == self::$ins ) {
    			return new self;
    		}
    
    		return self::$ins;
    	}

    it should refer to the original one, if one already exists.

    The fix for this problem is that to add
    self::$ins = $this;
    at the constructor like:

    public function __construct() {
    	    self::$ins = $this;
    ...
    }

    We are looking forward to your feedback.

    Best regards,
    Laszlo.

  • The topic ‘Singleton pattern’ is closed to new replies.