Remove the “DashBoard” from the adminbar
-
I just upgraded the newest version of BP and need some serious help in removing the “DashBoard” section from the adminbar. Can any one please help me?
-
If you don’t have one yet, create a bp-custom.php file and`add this:
`<?phpremove_action( ‘bp_adminbar_menus’, ‘bp_adminbar_thisblog_menu’, 6 );
?>`
As puzzled over in another similar thread request what is the issue with this addition. Wish people would describe there setup and reasons for serious requests then perhaps we could look for better overall solutions rather than simply hack at things!
These are the lines in ‘bp-core-adminbar.php’ that add the new menu items:
(wp-content>plugins>buddypress>bp-core>bp-core-adminbar.php)add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6 );
add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_thisblog_menu’, 6 );add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_authors_menu’, 12 );
You can ‘remove_action’ as mentioned above or simply delete the lines of the menu items you don’t want. The plugin “Add All Nav Links to BP Adminbar” is a nice plugin with options for modifying the admin bar. (It doesn’t have options for the new ‘dashboard’ menu but I’m sure it will on the next update.)
Word.
mercime’s solution should work nicely.
Keep in mind that the Dashboard option only appears for logged-in users who have a role greater than Subscriber on your blog.
@mercime, remember if you put this in bp-custom.php you need to remove the beginning php tag, and the end tag because it will cause a parse error: unexpected “<" error.
If you have any other suggestions for the plugin, please let me know here:
https://buddypress.org/community/groups/add-all-nav-links-to-bp-adminbar/forum/topic/what-would-you-like-to-see-in-the-next-update/@gunju2221 you need to have the opening “ to surround code especially if you just created a new bp-custom.php. The parse error you mentioned may have been caused by something else.
@mercime The tags are not needed in bp-custom.php because “unexpected “<" is referring to the tags, "unexpected" means there is an error in the code of where of it simply shouldn't be there. (tested, removed tags solved parse error)
Maybe I have the special bp-custom.php, but from my understanding you only need opening tags is of when you are creating or calling a brand new function, otherwise being split up in the file by a “}”
I could be wrong, but this is how I make php work.
I don’t know if it’s proper but I only edited my CSS file and added
li#bp-adminbar-thisblog-menu {display:none;}
and that did the trick!
@gunju2221 thing is Savanah Mercime is pretty experienced with BP and no doubt even more experienced with PHP
For the php parsing engine to work you must have php tags around your script elements, common practice is to open and close those tags when needing to parse markup, or one adds one opening and one closing set and all markup in the script needs to be set as echoed strings, variables or the heredoc function called.
Likely you have a file that is using supplied snippets written by members and which for potability each have their own set of tags.
Oh, mercime is far ahead of the game, I am just trying to figure out why the tags arn’t needed for me, as I know they are always needed.
mercime’s code worked.
@Boones George: “Keep in mind that the Dashboard option only appears for logged-in users who have a role greater than Subscriber on your blog.”— I am using One Quick post for front end posting coz I dont allow members/editors/authors to access the backend. They have higher roles, therefore they can see the dashboard from the BP Admin bar. My question now is, is there a code for roles higher than subscriber not to see the Dashboard link?
`<?php
remove_action( ‘bp_adminbar_menus’, ‘bp_adminbar_thisblog_menu’, 6 );
?>`
didn’t work for me for some reason..? I thought it might be clashing with the dashboard commander plugin so tried de-activating that plugin to no avail
tried as suggested in a bp-custom.php in my bp-default child theme
bp-custom.php goes into the plugins folder immediately under /wp-content/plugins/ not in a theme folder/directory….
sorry yep thats where i put the bp-custom.php
tried it again this time I got a blank screen and cant login to the site now
another site break – I’ve really gotta get a test site done
Just doing the plain: remove_action call in bp-custom.php isn’t working for me either on 1.5.n
Instead, to get it to work, put the remove_action call in a hook on init in your bp-custom.php
add_action("init","my_on_init");
function my_on_init(){
remove_action('bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6);
}
- The topic ‘Remove the “DashBoard” from the adminbar’ is closed to new replies.