xprofile_insert_field_group( array|string $args = '' )

Insert a new profile field group.

Description

Parameters

$args

(array|string) (Optional) Array of arguments for field group insertion.

  • 'field_group_id'
    (int|bool) ID of the field group to insert into.
  • 'name'
    (string|bool) Name of the group.
  • 'description'
    (string) Field group description.
  • 'can_delete'
    (bool) Whether or not the field group can be deleted.

Default value: ''

Return

(boolean)

Source

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

function xprofile_insert_field_group( $args = '' ) {

	// Parse the arguments.
	$r = bp_parse_args( $args, array(
		'field_group_id' => false,
		'name'           => false,
		'description'    => '',
		'can_delete'     => true
	), 'xprofile_insert_field_group' );

	// Bail if no group name.
	if ( empty( $r['name'] ) ) {
		return false;
	}

	// Create new field group object, maybe using an existing ID.
	$field_group              = new BP_XProfile_Group( $r['field_group_id'] );
	$field_group->name        = $r['name'];
	$field_group->description = $r['description'];
	$field_group->can_delete  = $r['can_delete'];

	return $field_group->save();
}

Changelog

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.