xprofile_admin_manage_group( int|null $group_id = null )
Handles the adding or editing of groups.
Description
Parameters
- $group_id
-
(Optional) Group ID to manage.
Default value: null
Source
File: bp-xprofile/bp-xprofile-admin.php
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | 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.