Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Limit Blog Creation to Admins


squattingturnip
Participant

@squattingturnip

Thank you, thank you, thank you.

Your code works like a charm, and you have taught me a great deal about how BuddyPress (and WPMU) works. I really, really appreciate it.

Incidentally, the changes I made are as follows, in case your or anyone else is curious:

global $current_user;
if ( isset( $roles['administrator'] ) || isset( $roles['editor'] ) || isset( $roles['contributor'] ) || is_site_admin() )

was added to the “my_can_user_create_a_blog” function. Kind of an odd set of conditions, but, well…whatever. I\’m going to do a little bit of digging around later on, and see if I can condense that down a little (initially I’d planned to have it as a sort of “if user level is great than x” thing, but my cursory examination didn’t turn that up, so this is a decent stopgap for now).

I also added an if statement that draws on the “my_can_user_create_a_blog” function for the “my_blogs_setup_nav” function, so that now everything it does is wrapped thusly:

if (my_can_user_create_a_blog()==true) {
...
}

and changed “is_user_logged_in” in the “my_adminbar_blogs_menu” function to call “my_can_user_create_a_blog” instead.

Again, I can’t thank you enough. I only hope some day I can help someone out the way you’ve helped me.

Skip to toolbar