• Resolved myladeybugg

    (@myladeybugg)


    I am currently running multisite with Buddypress and am wondering if there is a way to disable users from deleting their sites?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I figure there are a couple ways to accomplish this. You could remove the menu item from the tools submenu with an mu-plugin:

    <?php
    add_action( '_admin_menu', 'ds_menu_delete_disable' );
    function ds_menu_delete_disable() {
    	global $submenu, $menu;
    			if(is_super_admin())
    			return;
    	if(current_user_can('manage_options')) {
    		if(!empty($submenu['tools.php'])) {
    		foreach($submenu['tools.php'] as $key => $sm) {
    			if(__($sm[0]) == __('Delete Site') || $sm[2] == "ms-delete-site.php") {
    				unset($submenu['tools.php'][$key]);
    				break;
    				}
    			}
    		}
    		if( strpos($_SERVER['REQUEST_URI'], 'ms-delete-site.php'))
    			{ wp_redirect('profile.php'); exit(); }
    	}
    }
    ?>

    Or you could leave the menu alone and add a fun filter to the confirmation email with an mu-plugin:

    <?php
    add_filter( 'delete_site_email_content', 'no_delete_my_site' );
    function no_delete_my_site() {
    $content = 'To delete your site, send $100 to my paypal link on ###SITE_NAME###';
    return $content;
    }
    ?>
    Thread Starter myladeybugg

    (@myladeybugg)

    Went for the first solution and it worked like a charm! Love the second solution ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable site deletion’ is closed to new replies.