• Resolved vishalzala18

    (@vishalzala18)


    I have added an extra tab on the Account Page and I want to disable that tab for some users (role)

    Here is the code I have used :

    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-icon-bookmark';
    	$tabs[800]['mytab2']['title'] = 'Submit Resume';
    	$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">
    		
    		<?php echo do_shortcode('[submit_resume_form]'); ?>
    		
    	</div>		
    		
    	<?php
    		
    	$output .= ob_get_contents();
    	ob_end_clean();
    	return $output;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @vishalzala18

    Please try something like following code snippet:

    add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um2', 100 );
    function my_custom_tab_in_um2( $tabs ) {
    	
    	$user_id = get_current_user_id();
    	um_fetch_user( $user_id );
    
    	if ( UM()->user()->get_role() == 'paid-member' ) {
    
    		$tabs[800]['mytab2']['icon'] = 'um-icon-bookmark';
    		$tabs[800]['mytab2']['title'] = 'Submit Resume';
    		$tabs[800]['mytab2']['custom'] = true;
    
    	}
    	
    	return $tabs;
    }

    In the above example, a tab will be added only for users with ‘paid-member‘ role. So, you will have to make changes as per your requirement.

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hey there!

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display a tab in the Account Page,Visible only to the owner with a specific role’ is closed to new replies.