This topic has 5 replies, 2 voices, and was last updated 11 years by SQadmin.

  • Author
  • #7025
     mcgreggor
    Participant

    Hi,

    I’ve added 2 more tabs next to the profile image by adding the code below to functions.php.


    function kleo_my_actions()
    {
    global $bp_tabs;
    //rename tab 'About me' to 'About the artist'
    $bp_tabs['base'] = array(
    'type' => 'regular',
    'name' => apply_filters('kleo_extra_tab2',__('About the artist', 'kleo_framework')),
    'group' => 'General Info',
    'class' => 'regulartab'
    );
    // Add tab 'Additional'
    $bp_tabs['additional'] = array(
    'type' => 'regular',
    'name' => __('Additional information', 'kleo_framework'),
    'class' => 'regulartab'
    );
    // Add tab 'Contact Details'
    $bp_tabs['contact details'] = array(
    'type' => 'regular',
    'name' => __('Contact Details', 'kleo_framework'),
    'class' => 'regulartab'
    );

    }

    I need to hide the tabs “additional information” and “contact details” for non-paying members. Can this be done?

    Thanks
    McGreggor

    #7071
     SQadmin
    Keymaster

    You could try adding those two arrays in a if condition to check for level IDs:

    COPY CODE
    
    if ( pmpro_hasMembershipLevel(array(2,3))) {
    $bp_tabs  2 arrays ....
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #7101
     mcgreggor
    Participant

    Thanks but that’s not what I’m after. I guess I wasn’t clear enough before.
    I want the tabs not displayed on members pages if that member is not a paying member.

    Something like this but it isn’t working:

    COPY CODE
    
    $user_id = $bp->displayed_user->id;
    if (pmpro_hasMembershipLevel(NULL, $user_id)) {	
        $bp_tabs  2 arrays ....
    }
    

    Thanks for helping me out.

    #7202
     SQadmin
    Keymaster

    Hi, The code above has some missing parts. This should do the trick:

    COPY CODE
    
    add_action('bp_after_member_header','kleo_my_actions1', 1);
    
    function kleo_my_actions1()
    {
    	global $bp_tabs;
    	$bp_tabs = array();
    
    	$bp_tabs['base'] = array(
    	'type' => 'regular',
    	'name' => apply_filters('kleo_extra_tab2',__('About the artist', 'kleo_framework')),
    	'group' => 'General Info',
    	'class' => 'regulartab'
    	);
    	
    	$user_id = bp_displayed_user_id();
    	if (pmpro_hasMembershipLevel(array(5,6), $user_id)) {
    		// Add tab 'Additional'
    		$bp_tabs['additional'] = array(
    		'type' => 'regular',
    		'name' => __('Additional information', 'kleo_framework'),
    		'class' => 'regulartab'
    		);
    		// Add tab 'Contact Details'
    		$bp_tabs['contact details'] = array(
    		'type' => 'regular',
    		'name' => __('Contact Details', 'kleo_framework'),
    		'class' => 'regulartab'
    		);
    	}
    
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #7206
     mcgreggor
    Participant

    Perfect!

    Thanks once again for a great theme and top-notch support!

    #7218
     SQadmin
    Keymaster

    Glad we could help 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?