• Resolved ankaabraham

    (@ankaabraham)


    Hi guys. really loving Ultimate member. But I have one a simple problem. I added a new custom tab in the user profile using the code snippet from the page: https://docs.ultimatemember.com/article/69-how-do-i-add-my-extra-tabs-to-user-profiles.
    I used the “How to add several extra tabs, example:” code.
    The problem I have is that those extra tabs are not restricted to only appear in the user’s profile, like the ones that come by default. Instead, they appear on every profile. Does anyone know how this could be solved?

    • This topic was modified 5 years, 9 months ago by ankaabraham.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @ankaabraham

    Did you mean you want to make it visible to their own profile only? and not visible to others?

    Regards,

    Thread Starter ankaabraham

    (@ankaabraham)

    Exactly!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @ankaabraham

    You can use this condition:

    function um_mycustomtab_add_tab( $tabs ) {
    
        if ( um_is_myprofile() && get_current_user_id() == um_profile_id() ) { // The Condition
      
    	$tabs[ 'mycustomtab' ] = array(
    		'name'   => 'My Custom',
    		'icon'   => 'um-faicon-pencil',
    		'custom' => true
    	);
    
    	UM()->options()->options[ 'profile_tab_' . 'mycustomtab' ] = true;
    
    	return $tabs;
         }
     
    }
    add_filter( 'um_profile_tabs', 'um_mycustomtab_add_tab', 1000 );
    

    Regards,

    Thread Starter ankaabraham

    (@ankaabraham)

    Sorry but when I add this : if ( um_is_myprofile() && get_current_user_id() == um_profile_id() ) { it just breaks other links, for example the offer link only shows a 505 error. Co yo know what causes it? This is my current code, where or how would you add it? Thanks for being so helpful.

    function um_mycustomtab_add_tab( $tabs ) {

    /* Mis candidaturas */

    $tabs[‘ld_lista_candidaturas’] = array(
    ‘name’ => ‘Mis candidaturas’,
    ‘icon’ => ‘um-faicon-suitcase’,
    ‘custom’ => true
    );

    if ( !isset( UM()->options()->options[‘profile_tab_’ . ‘ld_lista_candidaturas’] ) ) {
    UM()->options()->update( ‘profile_tab_’ . ‘ld_lista_candidaturas’, true );
    }

    /* Candidatos */
    $tabs[‘Id_lista_miscandidatos’] = array(
    ‘name’ => ‘Mis Candidatos’,
    ‘icon’ => ‘um-faicon-users’,
    ‘custom’ => true
    );

    if ( !isset( UM()->options()->options[‘profile_tab_’ . ‘Id_lista_miscandidatos’] ) ) {
    UM()->options()->update( ‘profile_tab_’ . ‘Id_lista_miscandidatos’, true );
    }
    $tabs[‘ld_mis_ofertas’] = array(
    ‘name’ => ‘Mis ofertas’,
    ‘icon’ => ‘um-faicon-inbox’,
    ‘custom’ => true
    );

    if ( !isset( UM()->options()->options[‘profile_tab_’ . ‘ld_mis_ofertas’] ) ) {
    UM()->options()->update( ‘profile_tab_’ . ‘ld_mis_ofertas’, true );
    }

    /* Cuenta */
    $tabs[‘mi_cuenta’] = array(
    ‘name’ => ‘ Cuenta’,
    ‘icon’ => ‘um-faicon-lock’,
    ‘custom’ => true
    );

    if ( !isset( UM()->options()->options[‘profile_tab_’ . ‘mi_cuenta’] ) ) {
    UM()->options()->update( ‘profile_tab_’ . ‘mi_cuenta’, true );
    }

    return $tabs;
    }
    }
    add_filter( ‘um_profile_tabs’, ‘um_mycustomtab_add_tab’, 1000 );

    /**
    * Render the tab ‘Mis candidaturas’
    * @param array $args
    */
    function um_profile_content_ld_lista_candidaturas( $args ) {
    echo do_shortcode( ‘[job_bm_my_applications]’ );
    }
    add_action( ‘um_profile_content_ld_lista_candidaturas’, ‘um_profile_content_ld_lista_candidaturas’ );

    /**
    * Render the tab ‘Mis Candidatos’
    * @param array $args
    */
    function um_profile_content_Id_lista_miscandidatos( $args ) {
    echo do_shortcode( ‘[job_bm_applications]’ );
    }
    add_action( ‘um_profile_content_Id_lista_miscandidatos’, ‘um_profile_content_Id_lista_miscandidatos’ );
    /**
    * Render the tab ‘Mis ofertas’
    * @param array $args
    */
    function um_profile_content_ld_mis_ofertas( $args ) {
    echo do_shortcode( ‘[job_bm_my_jobs]’ );
    }
    add_action( ‘um_profile_content_ld_mis_ofertas’, ‘um_profile_content_ld_mis_ofertas’ );

    /**
    * Render the tab ‘Cuenta’
    * @param array $args
    */
    function um_profile_content_mi_cuenta( $args ) {
    echo do_shortcode( ‘[ultimatemember_account]’ );
    }
    add_action( ‘um_profile_content_mi_cuenta’, ‘um_profile_content_mi_cuenta’ );

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom tab overlay on other profiles’ is closed to new replies.