• Resolved blumbreras

    (@blumbreras)


    Hi,

    I’m trying to create a new tab in my account but I don’t get it.
    That’s what I’m doing.

    add_filter( ‘user_registration_account_menu_items’, ‘ur_custom_menu_items’, 10, 1 );
    function ur_custom_menu_items( $items ) {
    $items[‘prueba-item’] = __( ‘Pruebas’, ‘user-prueba ‘ );
    return $items;
    }

    add_action (‘init’, ‘user_ prueba _my_account’);
    function user_ prueba _my_account(){
    add_rewrite_endpoint(‘ prueba -item’, EP_PAGES);
    }

    function user_ prueba _my_account_content(){
    echo ‘hello world’;
    }

    add_action (‘user_prueba_my_account’, ‘user_prueba_my_account_content’);

    Whats wrong??

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @blumbreras,

    Your code should be as follow:

    add_filter( 'user_registration_account_menu_items', 'ur_custom_menu_items', 10, 1 );
    function ur_custom_menu_items( $items ) {
    	$items['prueba-item'] = __( 'Pruebas', 'user-registration' );
    	return $items;
    }
    
    add_action( 'init', 'user_prueba_my_account' );
    function user_prueba_my_account() {
    	add_rewrite_endpoint( 'prueba-item', EP_PAGES );
    }
    
    function user_prueba_my_account_content() {
    	echo 'hello world';
    }
    add_action( 'user_registration_account_prueba-item_endpoint', 'user_prueba_my_account_content' );
    

    The part gone wrong was the last hook. It’s format should be user_registration_account_<Your Endpoint>_endpoint. And there was much space between function name and hooks. But I guess it was the typo on pasting the code in support.

    And if the page doesn’t show up. Please try refreshing the permalink by going to Dashboard > Settings > Permalinks and just save it.

    Regards!

    Thread Starter blumbreras

    (@blumbreras)

    Thanks for your help! I works great!!

    Regards,

    Hi,
    I am new using this plugin, can u send more info where to add the code.
    followed the instructions and it’s not working, don’t see the new tab.

    Created new php file as u indicated, and added all the code there.
    chosen-theme/user-registration/myaccount/new-item.php

    not sure where to add the last portion.
    function user_registration_new_item_endpoint_content() {
    ur_get_template( ‘myaccount/new-item.php’);
    }
    do i add this in the functions.php

    Thank you,

    Thread Starter blumbreras

    (@blumbreras)

    Hi lalis!

    I have a plugin called “code snippets” and I have insert there all the code necessary for the tabs of the user registration form.

    I hope it helps you!

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘New additional tab in my account’ is closed to new replies.