• Resolved Kawah Buku

    (@kawahbuku)


    Is there any way to include a 2FA setting for our customers, in their My Account page, as one of the tabs (endpoints)?

    I found this useful tutorial (https://sanjeebaryal.com.np/add-a-new-custom-tab-in-the-woocommerce-account-page/), however, I am still confused about how to insert this plugin setup into that new tab in My Account.

    Before this, I use WP Defender (WPMU DEV) and they automatically add an endpoint tab in My Account, however, when I change to WP 2FA (for several reasons), looks like this basic necessity for the customer isn’t automatically viable though the plugin setting. At least you have to enable 2FA setting through one of the custom endpoints in WooCommerce.

Viewing 5 replies - 1 through 5 (of 5 total)
  • carmpocalypse

    (@carmpocalypse)

    @kawahbuku

    If you made a new endpoint and tab in your Account Page already, you can insert the WP 2FA shortcode. Their documentation on it you can find here.

    You can use:
    [wp-2fa-setup-form]

    Plugin Contributor robertabela

    (@robert681)

    Hello @kawahbuku

    Thank you for using our plugin and thanks @carmpocalypse for the answer.

    We have a more “WooCommerce specific” document that explains how to add a link for 2FA in the WooCommerce My Account page.

    I hope that helps. Please let us know if you need any further information.

    P.S. in future updates we will be adding this via a simple setting.

    Thread Starter Kawah Buku

    (@kawahbuku)

    Hi @carmpocalypse and @robert681,

    Thank you to you both. I really appreciate it. After a few tweaks, I found a way to insert the additional tab on My Account in functions.php.

    I name that tab ‘Security’ and the link will be https://example.com/account/security as their endpoint URL.

    Anyone who wants to use this code may rewrite ‘security’ to any term they prefer.

    // ADD SECURITY TAB ON MY ACCOUNT
    
    add_action( 'init', 'register_security_endpoint');
    
    /**
     * Register New Endpoint.
     *
     * @return void.
     */
    function register_security_endpoint() {
    	add_rewrite_endpoint( 'security', EP_ROOT | EP_PAGES );
    }
    
    add_filter( 'query_vars', 'security_query_vars' );
    
    /**
     * Add new query var.
     *
     * @param array $vars vars.
     *
     * @return array An array of items.
     */
    function security_query_vars( $vars ) {
    
    	$vars[] = 'security';
    	return $vars;
    }
    
    add_filter( 'woocommerce_account_menu_items', 'add_security_tab' );
    
    /**
     * Add Security tab in my account page.
     *
     * @param array $items myaccount Items.
     *
     * @return array Items including New tab.
     */
    function add_security_tab( $items ) {
    
    	$items['security'] = 'Security';
    	return $items;
    }
    
    add_action( 'woocommerce_account_security_endpoint', 'add_security_content' );
    
    /**
     * Add content to the Security tab.
     *
     * @return  string.
     */
    function add_security_content() {
        
        echo "<h1>Security</h1>";
    	echo 'With two-factor authentication, also called 2-Step Verification, you can add an extra layer of security to your account in case your password is stolen. After you set up two-factor authentication, you can sign in to your account with your password and your phone.';
    	echo do_shortcode('[wp-2fa-setup-form show_preamble="false"]'); 
    
    }
    
    • This reply was modified 2 years ago by Kawah Buku.
    Thread Starter Kawah Buku

    (@kawahbuku)

    Again @robert681, that’s great news. Can’t wait for this update to come into plugin’s simple setting. I really love this 2FA plugin because of its simplicity.

    Plugin Contributor robertabela

    (@robert681)

    Thank you for sharing your script @kawahbuku

    I am glad you solved the issue. your script should help a few users. I am also glad to read that you like the plugin as well. Please do not forget to spare a minute to rate the plugin. These reviews are really helpful.

    Have a great weekend.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘2FA setting in My Account endpoints’ is closed to new replies.