Search Results for 'Hide Admin'
-
AuthorSearch Results
-
October 25, 2016 at 9:38 am #260277
In reply to: Hide xProfile fields from EDIT
danbp
ParticipantIt relate to this filter bp_get_profile_field_data
This example will hide tabs and fields to all except admin
function bpfr_hide_profile_field_group( $retval ) { if ( bp_is_active( 'xprofile' ) ) : // hide profile group/field to all except admin if ( !is_super_admin() ) { //exlude fields, separated by comma $retval['exclude_fields'] = '1'; //exlude groups, separated by comma $retval['exclude_groups'] = '3'; } return $retval; endif; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );These tricks hide the tab content, not the tab itself. (it seems that it doesn’t work for groups at the moment…i asked devs for information) Use CSS display:none to hide the tab or consider this plugin.
October 21, 2016 at 11:03 am #260140In reply to: Hide the whole Base profile field group
bid9jafd
ParticipantThanks again.
I’d missed the second example, but, unfortunately, it doesn’t solve the issue.
If not enough, you use
CSS display:none;for the BASE markup on profile edit tab.I attempted to do this but I’m unable to target the BASE group without also affecting the USER INFO group
I noticed, too, that the “hide fields or field group to members, but not to site admin” code was preventing user registrations from going through, for some reason. It was quickly redirecting users to the home page, rather than a success or failure message page, when they clicked on the “complete sign up” button.
I think what I’ll have to do is put all fields in the BASE group & go with what @shanebp suggested in the thread I linked in my first post. & hope that potential subscribers aren’t put off by the registration form.
October 9, 2016 at 7:41 pm #259656In reply to: Admin bar icons do not display on some devices
giuseppecuttone
ParticipantI will be your savior,
for same rasons, wordpress decided not show admin bar like default in mobile.
It is so,maybe, because when user log in in mobile device, a lot of menu will be showed… really I dont know why…
But if you dont have this problem, and want show admin bar for log in an log out users, you must add in CSS the following codec:@media screen and (max-width:782px) { #wpadminbar { display:block; } html { position:absolute; top:-46px; } }The codec where say html position absolute is for delete noise black bar located in the up side zone.
If you want, you can also show the notification icon (I think it is named budlle notification) into the admin mar, adding the following codec in CSS zone:/* Show only default top level items */ #wp-toolbar > ul > li { display: block; }I have gone mad to find the solution, but now we have it.
If you dont want show menu in admin bar to the suscriptors, colaborator and authors, you can use the AG CUSTOM ADMIN plugin. It hide them and help you in a clean design. (you can also hide wordpress logo, and so much things…)Now, I have only a litlle / big problem:
the drop down menu, when I click in the “notification icon” in the admin bar, is not showed correctly… It is showed from the “notification icon” to the right zone, so in mobiles user can red the title of the notification.
The solution is show the dropdown menu from the “notification icon” to the left zone. So, also in mobiles users can red the title of the notification.
Can you help me for to make that?
I have helped you, now I hope someone can help me š
Thank for your support and have funnyOctober 1, 2016 at 3:16 am #259293In reply to: securing admin login user name
ckchaudhary
ParticipantHi Earl,
Two things you can do:- Hide admin user from members list. This post has some answers:- https://buddypress.org/support/topic/hide-admin-from-members-and-activity/
- Change the user_nicename field in users table in database, for the admin user.
I suggest going with the first option.
September 19, 2016 at 5:37 pm #258920Brajesh Singh
ParticipantPlease put this code in your bp-custom.php
function buddydev_hide_members_directory_from_all_except_admin() { if ( bp_is_members_directory() && ! is_super_admin() ) { //should we add a message too? //bp_core_add_message( 'Private page.', 'error' ); bp_core_redirect( site_url('/') ); } } add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );That should do it. Hoe it helps.
September 18, 2016 at 8:29 pm #258900danbp
ParticipantHere “the best guarded secret” finally revealed !
But it’s not a secret, is part of Codex and a multi handled topic subject on this forum.What we want to do: remove access possibility.
Where: on BuddyBar navigation menu (the one below the profile header).
Specifics: make the activity and forum tabs only visible to the logged in user.NOTE: The activity tab is shown by default when you visit a profile.
As we are going to hide/remove this tab to visitors, we need to define as first another default tab. If we won’t do that, the visitor will get a Page not found error. Which is not exactly the case here, the page exist but the visitor can’t access it.
Let’s define arbitrary Profile as the new default tab. You can of course define what ever other existing tab on your BuddyBar as default.
Add this line to bp-custom.php
define( 'BP_DEFAULT_COMPONENT','profile' );Now the mega “open secret” !
The folowing snippet contains almost any BP menu items you can have on a BuddyBar, and includes also the Forum item, in case you use bbPress.
You can remove or comment out those you don’t want to use.
Note also that it is only an example – you have to play with it to fit your need. But at least you have the right syntax to use.
Note also that some profile menu items are user only, such as message or notice. In other words, these are always private.This function goes preferably to bp-custom.php
function bpfr_hide_tabs() { global $bp; /** * class_exists() & bp_is_active are recommanded to avoid problems during updates * or when Component is deactivated */ if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) : /** here we fix the conditions. * Are we on a profile page ? | is user site admin ? | is user logged in ? */ if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) { /* and here we remove our stuff ! */ bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); } endif; } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );Some other hints for privacy
if you want to allow only the profile owner to view some tabs, replace
!is_user_logged_inby!bp_is_my_profile()– this scenario doesn’t need a check for logged in users as it is made bybp_is_my_profile.If you want only to make a profile private, read here.
If you want to remove a sub-nav item (ie. View on Profile), you use something like:
bp_core_remove_subnav_item( 'profile', 'view' );Many other possibilities for navigation are also available, including for groups. Several examples are given on Codex, here.
And if not enough, RTFM and search the forum ! š
Have fun !
September 14, 2016 at 6:29 pm #258723In reply to: Eliminate buddypress pages
ckchaudhary
ParticipantIf you are on latest version of buddypress( > 2.6 ), the following code will work:
//hide setting nav in profile function w24dr_remove_settings_nav() { $bp = buddypress(); $bp->members->nav->delete_nav( bp_get_settings_slug() ); } add_action( 'bp_setup_nav', 'w24dr_remove_settings_nav' ); //redirect settings to main profile page function w24dr_redirect_settings_nav(){ if( bp_is_user() && bp_is_current_component( bp_get_settings_slug() ) ){ wp_redirect( bp_displayed_user_domain() ); exit(); } } add_action( 'template_redirect', 'w24dr_redirect_settings_nav' );But it still doesn’t remove ‘settings’ nav from adminbar. You need to work some more to remove it from there.
September 11, 2016 at 2:40 am #258619jowyds
Participanthello danbp, thanks for your reply.
I have tried the suggestion to use
define('WP_DEBUG', true);in conjuction withdefine('WP_DEBUG_LOG', true);with a twenty theme. It works fine when buddypress is not activated. No error or logfile whatsover. Then after I tried to activate buddypress, and test again. The media library still cannot load out. I have tried to check for error log and I can’t seems to find any.Nevertheless I found the culprit can be my bp-custom.php in which I put it just under /wp-content/plugins/[here]
if I remove the file and everything seems works fine again with buddypress activated.
This is the content for my bp-custom.php
<?php // hacks and mods will go here /** * Make a site Private, works with/Without BuddyPress * * @author sbrajesh * @global string $pagenow * */ /* function buddydev_private_site() { //first exclude the wp-login.php //register //activate global $pagenow; //do not restrict logged in users if( is_user_logged_in() ) { return ; } //if we are here, the user is not logged in, so let us check for exclusion //we selectively exclude pages from the list //are we on login page? if( $pagenow == 'wp-login.php' ) { return ; } //let us exclude the home page if( is_front_page() ) { return ; } $exclude_pages = array( 'register', 'activate', 'excelportfolio' );//add the slugs here //is it one of the excluded pages, if yes, we just return and don't care if( is_page( $exclude_pages ) ) { return ; } $redirect_url = wp_login_url( site_url('/') );//get login url, wp_safe_redirect( $redirect_url ); exit( 0 ); } */ //add_action( 'template_redirect', 'buddydev_private_site', 0 ); ?> <style type="text/css"> #wp-admin-bar-bp-login { display:none; /* JOWY: hide login link for buddypress. */ } #wp-admin-bar-bp-register { display:none; /* JOWY: hide register link for buddypress. */ } #adminloginform { color: #ffffff; /* JOWY: text color on form. */ } #wpadminbar { opacity: 0.7; /* JOWY: Opacity for wpadminbar. */ } </style>what can possible went wrong?
September 3, 2016 at 5:01 pm #258342In reply to: [Resolved] Member Menu Alterations
Fantacular Designs
ParticipantMy brilliant husband is my coder… He figured out how to define the default component, and saved the day. I hope this helps others.
define( 'BP_DEFAULT_COMPONENT', 'profile' ); function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'activity'); bp_core_remove_nav_item( 'notifications'); bp_core_remove_nav_item( 'messages' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'settings' ); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );September 1, 2016 at 8:27 pm #258281In reply to: Private Messaging restriction
danbp
ParticipantHi,
you can try to remove the private message button from the template or hide it with CSS.
And add a custom one who leads to admin inbox.The link should look like
http://your-site.com/members/YOU/messages/compose/?r=THE ADMIN&_wpnonce=an_alpha_numeric_valueSee here how you may code this
Codex and Forum are your friends to search about template customization.
September 1, 2016 at 1:16 am #258234In reply to: [Resolved] Member Menu Alterations
Fantacular Designs
ParticipantI also attempted to add them individually…
function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'notifications' ); bp_core_remove_nav_item( 'messages' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); bp_core_remove_nav_item( 'settings' ); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );I’ve noticed some changes require us to repeat ourselves, while others allow us to list changes within one line of code. Haven’t deciphered this anomaly just yet.
September 1, 2016 at 1:02 am #258232In reply to: [Resolved] Member Menu Alterations
Fantacular Designs
ParticipantI placed the following code in the bp-custom.php which was found under the wp-content -> plugins.
function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && !is_super_admin() ) { bp_core_remove_nav_item( 'notifications', 'activity', 'groups', 'messages', 'forums', 'settings'); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );It breaks my site, shuts it down. From what I’ve read, I am supposed to specify what tab is open when opening a profile. Otherwise, browsers don’t know what to display since default is “Activity” and I’m removing it… Can someone please tell me where I went wrong? I appreciate the help!
August 31, 2016 at 1:00 pm #258209In reply to: [Resolved] Member Menu Alterations
danbp
ParticipantHi,
bp’s Usermenu is added to wp_admin_menu on the Toolbar, under Howdy. This BP menu ID is “my-account”.
When you’re on a profile page, you see also these items in the Buddymenu, below the profile header cover.
Some working examples here:
Remove an item from UsermenuRemove an item from Buddymenu
Since 2.6, BuddyPress use a navigation API. See here for many use case.
Read also WP codex about admin bar menus.
Where to put BuddyPress custom code ?
Usually into bp-custom.php. This file is to BP code what a child theme is to a theme: a safe place with high priority where nothing get to loose when an update occurs !Child’s functions.php should be reserved to whatever you need for the theme itself.
That said, it can happen(rarely) that some custom code won’t work from within bp-custom. In this case, feel free to remove it from bp-custom and give it a try inside child’s functions.php.As novice, you’re invited to read BP and WP codex if you want to customize.
August 26, 2016 at 9:21 pm #258103In reply to: New Privacy Plugin
danbp
ParticipantThe whole idea is that the profile is locked down completely so I donāt want the viewer to see the activity or any other part unless they fit the criteria laid out by the member.
I understand that. But as the member appears on SWA and directories, you have to go deeper into BP and hide his activities, remove it from directories and so on. Or as already said, give this as “ultimate” option, with a big warning to site admins – and to the user. Something like: if you choose this option, your whole profile (activity, friends and group membership list) will be hidden to all members and visitors.
It was initially for a client of yours, ok, but that’s a specific use case. I would better leave that possible from inside the plugin code only (ie. a filter that a dev could activate) and give a smoother option for common community usage to the majority of BP users.
August 24, 2016 at 8:22 am #257452In reply to: Changing adminbar site-name url
mrjarbenne
ParticipantYou could completely customize the Admin-bar. This snippet should help, put in either the functions.php file of your theme, or in the bp-custom.php file. It should give you a good idea of what is possible. I’m hiding the W menu. You could probably hide the Site dropdown altogether and then craft your own dropdown with links to different items. Particularly if this is a single install of BP, and not a Network/Multisite install, there really isn’t any reason for your users to see the Site dropdown:
/** * Adds custom "Home" menu to WP Adminbar. * * Also removes the "WP logo" menu. * * @param object $wp_admin_bar The WP Admin Bar object */ public function add_custom_parent_menu( $wp_admin_bar ) { /** * Removing the "W" menu */ $wp_admin_bar->remove_menu( 'wp-logo' ); /** * Create a "Home" menu. * * First, just create the parent menu item. */ $wp_admin_bar->add_menu( array( 'id' => 'commonlinks', 'parent' => '0', //puts it on the left-hand side 'title' => 'Home', 'href' => ('http://domain.com/activity') ) ); /** * Add submenu items to "Home" menu. */ // Only show the following for logged-in users if ( current_user_can( 'read' ) ) { // Support link $wp_admin_bar->add_menu( array( 'id' => 'support', 'parent' => 'commonlinks', 'title' => 'Support', 'href' => ('http://domain.com/support') ) ); // Blog request form $wp_admin_bar->add_menu( array( 'id' => 'blogrequest', 'parent' => 'commonlinks', 'title' => 'Feedback', 'href' => ('http://domain.com/feedback' ) ) ); // Developers blog $wp_admin_bar->add_menu( array( 'id' => 'developments', 'parent' => 'commonlinks', 'title' => 'Developments', 'href' => ('http://domain.com/developments' ) ) ); } }August 17, 2016 at 3:37 pm #257724In reply to: Activate BuddyPress components programmatically
Schweizer Solutions GmbH
ParticipantThank you Henry, but we already tried this hook.
Maybe I should give you some code:
class SKS_Test { public function __construct() { add_action( 'activated_plugin', array( $this, 'activated_plugin' ), 99, 1 ); } public function activated_plugin( $plugin ) { if ( $plugin == 'buddypress/bp-loader.php' && ! get_option( 'sks_installed', false ) ) { $bp_active_components = get_option( 'bp-active-components', array() ); $bp_active_components['groups'] = 1; delete_transient( '_bp_is_new_install' ); delete_transient( '_bp_activation_redirect' ); update_option( 'bp-active-components', $bp_active_components ); update_option( 'hide-loggedout-adminbar', 1 ); } } }The group component is still disabled in the settings of BuddyPress š
August 12, 2016 at 11:01 pm #257573Topic: Page and post budypress
in forum How-to & TroubleshootingNormadSoul
ParticipantIām going to do more with your admin groups .
For example
The box administrator with limited opportunities can base your group and take their users, and manage them . But it can not manage other groups.
Then the administrator and his group can hide posts or publish .
Group administrator can grant up to the author ās website , but can not modify pages of other groups ?
Possible?
Thank you
August 9, 2016 at 1:51 pm #257453In reply to: Changing adminbar site-name url
mrjarbenne
ParticipantYou could customize the adminbar completely, using this snippet. I’m hiding the W menu, but you could probably hid the Sites menu and then add your own dropdown with the requisite links.
http://www.wpbeginner.com/plugins/how-to-add-edit-re-order-or-hide-wordpress-admin-menus/
/** * Adds custom "Home" menu to WP Adminbar. * * Also removes the "WP logo" menu. * * @param object $wp_admin_bar The WP Admin Bar object */ public function add_custom_parent_menu( $wp_admin_bar ) { /** * Removing the "W" menu */ $wp_admin_bar->remove_menu( 'wp-logo' ); /** * Create a "Home" menu. * * First, just create the parent menu item. */ $wp_admin_bar->add_menu( array( 'id' => 'commonlinks', 'parent' => '0', //puts it on the left-hand side 'title' => 'Home', 'href' => ('INSERT LINK HERE') ) ); /** * Add submenu items to "Home" menu. */ // Only show the following for logged-in users if ( current_user_can( 'read' ) ) { // Support link $wp_admin_bar->add_menu( array( 'id' => 'support', 'parent' => 'commonlinks', 'title' => 'Support', 'href' => ('INSERT LINK HERE') ) ); // Blog request form $wp_admin_bar->add_menu( array( 'id' => 'blogrequest', 'parent' => 'commonlinks', 'title' => 'Stuff', 'href' => ('INSERT LINK HERE' ) ) ); // Developers blog $wp_admin_bar->add_menu( array( 'id' => 'developments', 'parent' => 'commonlinks', 'title' => 'Developments', 'href' => ('INSERT LINK HERE' ) ) ); } }August 7, 2016 at 9:28 pm #257327In reply to: [Resolved] the right way to remove nav items
danbp
ParticipantHi,
two snippets to remove profile and group items.
function bpex_hide_profile_menu_tabs() { if( bp_is_active( 'xprofile' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { // BP's profile main menu items. Comment those to show. // bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); // exist only if you use bbPress bp_core_remove_nav_item( 'forums' ); // BP's profile main menu items. Comment those to show. // bp_core_remove_subnav_item( 'activity', 'personnal' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 ); function bpex_remove_group_tabs() { if ( ! bp_is_group() ) { return; } $slug = bp_get_current_group_slug(); // hide items to all users except site admin if ( !is_super_admin() ) { // bp_core_remove_subnav_item( $slug, 'members' ); bp_core_remove_subnav_item( $slug, 'send-invites' ); // bp_core_remove_subnav_item( $slug, 'admin' ); // bp_core_remove_subnav_item( $slug, 'forum' ); } } add_action( 'bp_actions', 'bpex_remove_group_tabs' );July 10, 2016 at 2:26 pm #256419In reply to: How to hide profile menu items from other users
danbp
ParticipantIt’s the same principle, but not the same syntax since 2.6
To hide tabs on groups, you need to specify the component. Note that all menu items (nav and subnav items) are considered as sub-nav, they have not the same distinction as on member or activity menus.
Use another function for groups. Try this.
function bpex_remove_group_tabs() { if ( ! bp_is_group() ) { return; } $slug = bp_get_current_group_slug(); // hide items to all users except site admin if ( !is_super_admin() ) { // bp_core_remove_subnav_item( $slug, 'members' ); bp_core_remove_subnav_item( $slug, 'send-invites' ); // bp_core_remove_subnav_item( $slug, 'admin' ); // bp_core_remove_subnav_item( $slug, 'forum' ); } } add_action( 'bp_actions', 'bpex_remove_group_tabs' );To get more usage examples, see here:
July 10, 2016 at 12:09 pm #256411In reply to: How to hide profile menu items from other users
danbp
ParticipantAdd this snippet to bp-custom.php and give it a try.
function bpex_hide_profile_menu_tabs() { if( bp_is_active( 'xprofile' ) ) : if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) { // BP's profile main menu items. Comment those to show. // bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'profile' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); // exist only if you use bbPress bp_core_remove_nav_item( 'forums' ); // BP's profile main menu items. Comment those to show. // bp_core_remove_subnav_item( 'activity', 'personnal' ); bp_core_remove_subnav_item( 'activity', 'mentions' ); bp_core_remove_subnav_item( 'activity', 'favorites' ); bp_core_remove_subnav_item( 'activity', 'friends' ); bp_core_remove_subnav_item( 'activity', 'groups' ); } endif; } add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 );July 1, 2016 at 10:32 am #255613In reply to: Could not Save Basic Settings
siparker
ParticipantFor anyone who is looking for the solution for not being able to save buddypress settings.
Various plugins cause issues with adding various extra css in the admin area.
in my case there was a css file from a Codecanyon Woozone plugin which hid the P tags in the buddypress options pages
use firebug and find the bottom div that cotnains the submit button and disable any css that is hiding it and you can click the submit button.
after you have done that you might want to tell the plugin developer that caused the issue about it.
TLDR the button is there its probably just hidden. use firebug or chrome tools to unhide it and click save.
June 29, 2016 at 8:29 pm #255515navyspitfire
ParticipantHi Dan, thank you for your snippet. My issue was that I was trying to hide subscribers, admins, and the current user in the same function; separating subscribers/admins and current user into two different functions did the trick.
June 29, 2016 at 7:57 pm #255513danbp
ParticipantHi @navyspitfire,
when you pick up code somewhere, you should also read the comments. The solution to your issue was in one of them.
Here is what wil exclude site admin from members directory and exclude also the logged_in user. The total member count will also be adjusted correctly on All members [x] tab and for the pagination count.
$count-2instead of$count-1do the trick.Excluded members, incl. admin, are of course excluded from search.
function bpex_hide_admin_on_member_directory( $qs=false, $object=false ){ // Id's to hide, separated by comma $excluded_user = '1' ; // hide to members & friends if($object != 'members' && $object != 'friends') return $qs; $args = wp_parse_args($qs); if(!empty($args['user_id'])) return $qs; if(!empty($args['exclude'])) $args['exclude'] = $args['exclude'].','.$excluded_user; else $args['exclude'] = $excluded_user; $qs = build_query($args); return $qs; } add_action( 'bp_ajax_querystring','bpex_hide_admin_on_member_directory', 20, 2 ); // once admin is excluded, we must recount the members ! function bpex_hide_get_total_filter( $count ){ return $count-2; } add_filter( 'bp_get_total_member_count', 'bpex_hide_get_total_filter' ); function bpex_exclude_loggedin_user( $qs = false, $object = false ) { //list of users to exclude if( !is_user_logged_in() ) return $qs; //if the user is logged in , let us exclude her/him $excluded_user= get_current_user_id(); if( $object !='members' )//hide for members only return $qs; $args=wp_parse_args($qs); //check if we are listing friends?, do not exclude in this case if( !empty( $args[ 'user_id' ] ) ) return $qs; if( !empty( $args['exclude'] ) ) $args['exclude'] = $args['exclude'] .','. $excluded_user; else $args['exclude'] = $excluded_user; $qs = build_query( $args ); return $qs; } add_action('bp_ajax_querystring','bpex_exclude_loggedin_user', 20, 2 );Codex Reference
June 29, 2016 at 12:05 am #255452In reply to: [Resolved] Removing nav & subnav item in groups
danbp
Participant@gerwinb, use this snippet for 2.6 +. Corrected, tested and approved by @imath
function gwb_remove_group_admin_tab() { if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) { return; } // Add the admin subnav slug you want to hide in the // following array $hide_tabs = array( 'group-avatar' => 1, 'delete-group' => 1, ); $parent_nav_slug = bp_get_current_group_slug() . '_manage'; // Remove the nav items foreach ( array_keys( $hide_tabs ) as $tab ) { // Since 2.6, You just need to add the 'groups' parameter at the end of the bp_core_remove_subnav_item bp_core_remove_subnav_item( $parent_nav_slug, $tab, 'groups' ); } // You may want to be sure the user can't access if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) { bp_core_add_message( 'Sorry buddy, but this part is restricted to super admins!', 'error' ); bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) ); } } add_action( 'bp_actions', 'gwb_remove_group_admin_tab', 9 ); -
AuthorSearch Results