Replies: 0
Hi I would be so grateful if anyone could help:
I would like to set up a tab, say: LESSONS, for all but one of my user roles: STUDENT.
However, I would still like that role of STUDENT to be able to see the tab of LESSONS on everyone else’s profiles, even though they do not have it appear on their own.
I’ve researched this and tried all sorts of things but don’t seem able to conjure this up….I just need to amend it so as not to add the tab for STUDENT role.
My code starting point is here:
/**
* Add a new Profile tab
* @param array $tabs
* @return array
*/
function um_mycustomtab_add_tab2( $tabs ) {
/**
* You could set the default privacy for custom tab.
* There are values for 'default_privacy' attribute:
* 0 - Anyone,
* 1 - Guests only,
* 2 - Members only,
* 3 - Only the owner
*/
$tabs[ 'lessons' ] = array(
'name' => 'Lessons',
'icon' => 'um-faicon-rss',
'default_privacy' => 0,
);
UM()->options()->options[ 'profile_tab_' . 'lessons' ] = true;
return $tabs;
}
add_filter( 'um_profile_tabs', 'um_mycustomtab_add_tab2', 1000 );
/**
* Render tab content
* @param array $args
*/
function um_profile_content_lessons_default( $args ) {
echo do_shortcode('[shortcode here]');
}
add_action( 'um_profile_content_lessons_default', 'um_profile_content_lessons_default' );
Thank you 🙂