XProfile_Group::create( $args,  $assoc_args )

Create an XProfile group.


Description Description

Top ↑

OPTIONS OPTIONS

–name= : The name for this field group.

[–description=] : The description for this field group.

Top ↑

[–can-delete=] : Whether the group can be deleted. [–can-delete=] : Whether the group can be deleted.

Top ↑

default: 1 default: 1

[–porcelain] : Output just the new group id.

Top ↑

EXAMPLES EXAMPLES

$ wp bp xprofile group create --name="Group Name" --description="Xprofile Group Description"
Success: Created XProfile field group "Group Name" (ID 123).

$ wp bp xprofile group add --name="Another Group" --can-delete=false
Success: Created XProfile field group "Another Group" (ID 21212).

Source Source

File: cli/src/xprofile-group.php

	public function create( $args, $assoc_args ) {
		$r = wp_parse_args(
			$assoc_args,
			array(
				'name'        => '',
				'description' => '',
			)
		);

		$group_id = xprofile_insert_field_group( $r );

		if ( ! $group_id ) {
			WP_CLI::error( 'Could not create field group.' );
		}

		if ( WP_CLI\Utils\get_flag_value( $assoc_args, 'porcelain' ) ) {
			WP_CLI::log( $group_id );
		} else {
			$group   = new \BP_XProfile_Group( $group_id );
			$success = sprintf(
				'Created XProfile field group "%s" (ID %d).',
				$group->name,
				$group->id
			);
			WP_CLI::success( $success );
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

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