• Resolved smhaseeb

    (@haseeb007)


    Just installed the plugin. Finally found something I was looking for.
    But I need to achieve something slightly different.

    I’m using Two links:

    1. Log In | Log Out
    2. Register

    When The user clicks Log In, Log Out or Register link then the default WordPress login page appears.
    But I need to send the users to the WooCommerce My-Account page.

    I hope you understand my requirement.

    Thanks

    https://wordpress.org/plugins/baw-login-logout-menu/

Viewing 14 replies - 1 through 14 (of 14 total)
  • I am also trying to achieve the same thing for my existing WooCommerce website. There might be a possible way to set a custom login page url when we click on the Login link.

    Thread Starter smhaseeb

    (@haseeb007)

    Correct Sumit…
    Its been 2 days nobody answered yet…
    Hello… Anyone?

    Hey guys. Super easy to do without a plugin.

    Just add this to your function.php file

    /*Add LoginOut in Top Menu */
    add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
    function add_loginout_link( $items, $args ) {
    	if (is_user_logged_in() && $args->theme_location == 'top-menu') {
    			$items .= '
    
    • <a href="'. wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) .'">Log Out</a>
    • '; } elseif (!is_user_logged_in() && $args->theme_location == 'top-menu') { $items .= '
    • <a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">Log In</a>'; } return $items; }

    You may have to change the two spots where it says ‘top-menu’ to the name of your menu that is registered. Might be primary-menu for the main nav. I use it for my top navigation menu.

    David Swanson
    http://planglobal.net

    How do I change the WP-Login page to a custom login page in the above function?

    The code that I added in my post actually directs you to yourdomain.com/myaccount
    This is normally what you want if you are using WooCommerce.

    However, you can make it direct to any page you would like. Just change the two spots where you see ‘myaccount’ to whatever page. Example below

    wc_get_pageid( ‘myaccount ‘ ) instead wc_get_pageid (‘wp-login.php’ )

    Let me know if you need further help.

    David Swanson
    http://planglobal.net

    Great. I’ll test it out. Thank you

    David, this seems to be a good solution but is there a chance to style this new “menu-item”? It looks like it could need some padding on top.

    Hi Kainer,

    The code places the login/logout into a menu like your top menu or primary navigation menu. To add padding you would just add the padding to the entire navigation menu. That way it’s uniformed for the entire menu.

    David Swanson
    http://planglobal.net

    David, When mobile version of the site is loaded the login/logout link shows both on the page and in the mobile nav bar. How would I remove it from showing on the page?

    Plugin Author Julio Potier

    (@juliobox)

    The plugin is not designed to hook the login page, you have to use a custom code or plugin to achieve this, sorry.

    hello how to change my account by username

    Plugin Author Julio Potier

    (@juliobox)

    You’re not in the right place
    try this
    https://wordpress.org/support/forum/plugins-and-hacks#postform

    @david Swanson

    Can’t get it to work. I have added the code in to my theme’s function.php file. but nothing is happing? can you help me?

    Hi Unomas.

    Definitely! My personally website is https://davidswanson.me
    Go to: https://davidswanson.me/contact/
    Just send me a message on my contact us page saying your the guy..or lady (can’t tell by your username 🙂 ) from the WordPress forum. It will be easier, faster, and less intrusive to this forum if I help you through email.

    Plus it keeps us from publish our email addresses on this forum and getting spammed.

    Talk to you soon.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Send users to WooCommerce My-Account page instead of default WP Login/Logout pa’ is closed to new replies.