groups_screen_group_admin_delete_group()
Handle the display of the Delete Group page.
Description
Source
File: bp-groups/screens/single/admin/delete-group.php
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | function groups_screen_group_admin_delete_group() { if ( 'delete-group' != bp_get_group_current_admin_tab() ) return false; if ( ! bp_is_item_admin() && !bp_current_user_can( 'bp_moderate' ) ) return false; $bp = buddypress(); if ( isset( $_REQUEST [ 'delete-group-button' ] ) && isset( $_REQUEST [ 'delete-group-understand' ] ) ) { // Check the nonce first. if ( !check_admin_referer( 'groups_delete_group' ) ) { return false; } /** * Fires before the deletion of a group from the Delete Group page. * * @since BuddyPress 1.5.0 * * @param int $id ID of the group being deleted. */ do_action( 'groups_before_group_deleted' , $bp ->groups->current_group->id ); // Delete group forum if ( isset( $_REQUEST [ 'delete-group-forum-understand' ] ) ) { $forum_ids = bbp_get_group_forum_ids( $bp ->groups->current_group->id ); foreach ( $forum_ids as $forum_id ) { wp_delete_post( $forum_id , true ); } } // Group admin has deleted the group, now do it. if ( !groups_delete_group( $bp ->groups->current_group->id ) ) { bp_core_add_message( __( 'There was an error deleting the group. Please try again.' , 'buddyboss' ), 'error' ); } else { bp_core_add_message( __( 'The group was deleted successfully.' , 'buddyboss' ) ); /** * Fires after the deletion of a group from the Delete Group page. * * @since BuddyPress 1.0.0 * * @param int $id ID of the group being deleted. */ do_action( 'groups_group_deleted' , $bp ->groups->current_group->id ); bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) ); } bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) ); } /** * Fires before the loading of the Delete Group page template. * * @since BuddyPress 1.0.0 * * @param int $id ID of the group that is being displayed. */ do_action( 'groups_screen_group_admin_delete_group' , $bp ->groups->current_group->id ); /** * Filters the template to load for the Delete Group page. * * @since BuddyPress 1.0.0 * * @param string $value Path to the Delete Group template. */ bp_core_load_template( apply_filters( 'groups_template_group_admin_delete_group' , 'groups/single/home' ) ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.