xprofile_admin_delete_group( int $group_id )

Handles the deletion of profile data groups.


Parameters Parameters

$group_id

(int) (Required) ID of the group to delete.


Source Source

File: bp-xprofile/bp-xprofile-admin.php

function xprofile_admin_delete_group( $group_id ) {
	global $message, $type;

	check_admin_referer( 'bp_xprofile_delete_group' );

	$mode = ! empty( $_GET['mode'] )
		  ? sanitize_key( $_GET['mode'] )
		  : false;

	// Display the group delete confirmation screen.
	if ( 'delete_group' === $mode ) {
		xprofile_admin_delete_group_screen( $group_id );

	// Handle the deletion of group.
	} else {
		$group = new BP_XProfile_Group( $group_id );

		if ( ! $group->delete() ) {
			$message = _x( 'There was an error deleting the group. Please try again.', 'Error when deleting profile fields group', 'buddypress' );
			$type    = 'error';
		} else {
			$message = _x( 'The group was deleted successfully.', 'Profile fields group was deleted successfully', 'buddypress' );
			$type    = 'success';

			/**
			 * Fires at the end of group deletion process, if successful.
			 *
			 * @since 1.0.0
			 *
			 * @param BP_XProfile_Group $group Current BP_XProfile_Group object.
			 */
			do_action( 'xprofile_groups_deleted_group', $group );
		}

		xprofile_admin_screen( $message, $type );
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.