• Resolved neocraft

    (@neocraft)


    Hello,

    I know that i can use this code to add a menu in account page :

    /* add new tab called “mytab” */
    add_filter(‘um_account_page_default_tabs_hook’, ‘my_custom_tab_in_um’, 100 );
    function my_custom_tab_in_um( $tabs ) {
    $tabs[800][‘mytab’][‘icon’] = ‘um-faicon-pencil’;
    $tabs[800][‘mytab’][‘title’] = ‘My Custom Tab’;
    $tabs[800][‘mytab’][‘custom’] = true;
    return $tabs;
    }
    /* make our new tab hookable */
    add_action(‘um_account_tab__mytab’, ‘um_account_tab__mytab’);
    function um_account_tab__mytab( $info ) {
    global $ultimatemember;
    extract( $info );
    $output = $ultimatemember->account->get_tab_output(‘mytab’);
    if ( $output ) { echo $output; }
    }
    /* Finally we add some content in the tab */
    add_filter(‘um_account_content_hook_mytab’, ‘um_account_content_hook_mytab’);
    function um_account_content_hook_mytab( $output ){
    ob_start();
    ?>
    <div class=”um-field”>
    <!– Here goes your custom content –>
    </div>
    <?php
    $output .= ob_get_contents();
    ob_end_clean();
    return $output;
    }

    This is working well.
    But when i want to add a second menu using same code (but changing tab name), i’ve a blank account page…something don’t work.

    /* add new tab called “mytab2″ */
    add_filter(‘um_account_page_default_tabs_hook’, ‘my_custom_tab_in_um2’, 100 );
    function my_custom_tab_in_um2( $tabs ) {
    $tabs[800][‘mytab2’][‘icon’] = ‘um-faicon-pencil’;
    $tabs[800][‘mytab2’][‘title’] = ‘My Custom Tab 2’;
    $tabs[800][‘mytab2’][‘custom’] = true;
    return $tabs;
    }
    /* make our new tab hookable */
    add_action(‘um_account_tab__mytab2’, ‘um_account_tab__mytab2’);
    function um_account_tab__mytab2( $info ) {
    global $ultimatemember;
    extract( $info );
    $output = $ultimatemember->account->get_tab_output(‘mytab2’);
    if ( $output ) { echo $output; }
    }
    /* Finally we add some content in the tab */
    add_filter(‘um_account_content_hook_mytab2’, ‘um_account_content_hook_mytab2’);
    function um_account_content_hook_mytab2( $output ){
    ob_start();
    ?>
    <div class=”um-field”>
    <!– Here goes your custom content –>
    </div>
    <?php
    $output .= ob_get_contents();
    ob_end_clean();
    return $output;
    }

    What do i need to change else ?
    I’ve try changing this ‘$tabs[800]’ to ‘$tabs[900]’ but it’s not working too…

    Please help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter neocraft

    (@neocraft)

    finally found solution :

    // ACCOUNT TAB 1

    add_filter(‘um_account_page_default_tabs_hook’, ‘my_custom_tab_in_um’, 100 );
    function my_custom_tab_in_um( $tabs ) {
    $tabs[800][‘tab1’][‘icon’] = ‘um-faicon-arrow-circle-o-down’;
    $tabs[800][‘tab1’][‘title’] = ‘Tab 1’;
    $tabs[800][‘tab1’][‘custom’] = true;
    return $tabs;
    }

    add_action(‘um_account_tab__tab1’, ‘um_account_tab__tab1’);
    function um_account_tab__tab1( $info ) {
    global $ultimatemember;
    extract( $info );

    $output = $ultimatemember->account->get_tab_output(‘tab1’);
    if ( $output ) { echo $output; }
    }

    add_filter(‘um_account_content_hook_tab1’, ‘um_account_content_hook_tab1’);
    function um_account_content_hook_tab1( $output ){
    ob_start();
    ?>

    <div class=”um-field”>

    page or shortcode or content here.

    </div>

    <?php

    $output .= ob_get_contents();
    ob_end_clean();
    return $output;
    }

    // ACCOUNT TAB 2

    add_filter(‘um_account_page_default_tabs_hook’, ‘my_custom_tab_in_um2’, 100 );
    function my_custom_tab_in_um2( $tabs ) {
    $tabs[800][‘tab2’][‘icon’] = ‘um-faicon-pencil’;
    $tabs[800][‘tab2’][‘title’] = ‘Tab2’;
    $tabs[800][‘tab2’][‘custom’] = true;
    return $tabs;
    }

    add_action(‘um_account_tab__tab2’, ‘um_account_tab__tab2’);
    function um_account_tab__tab2( $info ) {
    global $ultimatemember;
    extract( $info );

    $output = $ultimatemember->account->get_tab_output(‘Tab 2’);
    if ( $output ) { echo $output; }
    }

    add_filter(‘um_account_content_hook_tab2’, ‘um_account_content_hook_tab2’);
    function um_account_content_hook_tab2( $output ){
    ob_start();
    ?>

    <div class=”um-field”>

    page or shortcode or content here.

    </div>

    <?php

    $output .= ob_get_contents();
    ob_end_clean();
    return $output;
    }

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @neocraft

    Thanks for letting us know that you’ve resolved this issue.

    I am closing this thread now.

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customize Account Page’ is closed to new replies.