Skip to:

Re: Limit Blog Creation to Admins

Burt Adsit


The member theme Blogs > Create a Blog and the admin bar My Account > Blogs > Create a Blog both get their menu items from the bp options nav array that each component sets up when they go through their init procedure.

In the case of the blogs component it’s the fn bp_blogs_setup_nav() in /buddypress/bp-blogs.php

The other menu item is the admin bar option My Blogs > Create a Blog at the bottom of that menu. That lives in the fn function bp_adminbar_blogs_menu() in /buddypress/bp-core/bp-core-adminbar.php

Without modifying the core files we can replace both of these fns with our own since they are triggered by actions in wp.

bp_blogs_setup_nav() responds when triggered like this:

add_action( ‘wp’, ‘bp_blogs_setup_nav’, 2 );

add_action( ‘admin_menu’, ‘bp_blogs_setup_nav’, 2 );

bp_adminbar_blogs_menu() responds when triggered like this:

add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6 );

(Saving again…)

Skip to toolbar