xprofile_admin_manage_group( int|null $group_id = null )
Handles the adding or editing of groups.
Description
Parameters
- $group_id
-
(int|null) (Optional) Group ID to manage.
Default value: null
Source
File: bp-xprofile/bp-xprofile-admin.php
function xprofile_admin_manage_group( $group_id = null ) { global $message, $type; // Get the field group. $group = new BP_XProfile_Group( $group_id ); // Updating. if ( isset( $_POST['save_group'] ) ) { // Check nonce check_admin_referer( 'bp_xprofile_admin_group', 'bp_xprofile_admin_group' ); // Validate $_POSTed data. if ( BP_XProfile_Group::admin_validate() ) { // Set the group name. $group->name = $_POST['group_name']; // Set the group description. if ( ! empty( $_POST['group_description'] ) ) { $group->description = $_POST['group_description']; } else { $group->description = ''; } // Attempt to save the field group. if ( false === $group->save() ) { $message = __( 'There was an error saving the field set. Please try again.', 'buddyboss' ); $type = 'error'; // Save successful. } else { $message = __( 'The field set was saved successfully.', 'buddyboss' ); $type = 'success'; // @todo remove these old options if ( 1 == $group_id ) { bp_update_option( 'bp-xprofile-base-group-name', $group->name ); } /** * Fires at the end of the group adding/saving process, if successful. * * @since BuddyPress 1.0.0 * * @param BP_XProfile_Group $group Current BP_XProfile_Group object. */ do_action( 'xprofile_groups_saved_group', $group ); } xprofile_admin_screen( $message, $type ); } else { $group->render_admin_form( $message ); } } else { $group->render_admin_form(); } }
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.