• Resolved zerve400

    (@borjahen)


    Hello. I’m trying to add a custom tab in the ‘Account’ sidebar (not Profile) to put a ‘Logout’ button there. I found several guides to create custom tabs but with content, not with a custom URL (in this case /logout)

Viewing 2 replies - 1 through 2 (of 2 total)
  • @borjahen

    You can try this code snippet for logging out from Account page:

    add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_logout', 100 );
    
    function my_custom_tab_logout( $tabs ) {
    
    	$tabs[800]['logout']['icon']        = 'um-icon-log-out';
    	$tabs[800]['logout']['title']       = __( 'Logout', 'ultimate-member' );
    	$tabs[800]['logout']['custom']      = true;
        $tabs[800]['logout']['show_button'] = false;
        
    	return $tabs;
    }
    
    add_filter( 'um_account_content_hook_logout', 'um_account_content_hook_logout' );
    
    function um_account_content_hook_logout( $output ) {
    
        $output .= '<div class="um-field">
                     <button>
                      <a href="' . esc_url( um_get_core_page( 'logout' ) ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>
                     </button>
                    </div>';
    
    	return $output;
    }

    Install the code snippet into your active theme’s functions.php file
    or use the “Code Snippets” plugin.

    https://www.ads-software.com/plugins/code-snippets/

    Thread Starter zerve400

    (@borjahen)

    Thank you very much for the help, it works perfectly! @missveronicatv

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Tab on ‘Account’ page with custom link’ is closed to new replies.