xprofile_insert_field_group( array|string $args = '' )

Insert a new profile field group.


Parameters 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: ''


Top ↑

Return Return

(boolean)


Source 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();
}


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.