-
Author
-
April 13, 2015 at 18:26 #54216thannahParticipant
Looking for a way to display Bp tabs to certain members. For example
‘TAB1’ and ‘TAB2 needs to only show up to Pmpro Level ID 2 & 3
‘TAB3’ and ‘TAB4’ needs to only show up to PmPro Level ID 4 & 5
Is there a custom code or something I can add to make this happen?
April 15, 2015 at 19:08 #54651AndreiModeratorHi, this is doable but unfortunately is a pretty custom request and if you don’t have the proper knowledge to do them by yourself then you’ll probably need to hire an developer to build this feature.
Let me know if I can help you with anything else.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 15, 2015 at 21:06 #54684thannahParticipantThank you. I can probably figure it out. I’ve learned alot about php since I started this project. What files would I work with to make these changes?
April 20, 2015 at 04:31 #55177AndreiModeratorHi,
I’ve spent some time on this so hope it will work as you expect:
COPY CODEfunction hide_profile_tabs_by_pmpro_level(){ if(function_exists('pmpro_hasMembershipLevel')){ global $bp_tabs, $current_user; $user_level = (int)$current_user->membership_level->ID; $allowed_tabs_per_level = array( '0' => array(), '1' => array('Base'), '2' => array('Base', 'Lifestyle'), ); if($bp_tabs){ foreach($bp_tabs as $bp_tab_id => $bp_tab){ if(!in_array($bp_tab['name'], $allowed_tabs_per_level[$user_level])){ unset($bp_tabs[$bp_tab_id]); } } } } } add_action('bp_after_member_header', 'hide_profile_tabs_by_pmpro_level', 1);
You just have to populate the $allowed_tabs_per_level array with your levels > tab names.
Let me know how it went.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 20, 2015 at 16:23 #55263thannahParticipantYou are an ANGEL! This worked like a pro and I have been banging my head up against the wall. Thank you so much! I’m a graphic designer so if there is anything I can help you with please let me know!
April 20, 2015 at 18:28 #55276AndreiModeratorI’m glad it helped you, would be nice if you could leave a review and a rate on themeforest when and if you have time.
ThanksHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 26, 2015 at 14:45 #70070eriklandParticipantHi Andrei!
I want to do the same in my theme, can you please tell me where this code needs to be placed?
Kind regards,
Erik
August 30, 2015 at 02:20 #75298AndreiModeratorIn the functions.php file from your active theme.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.