XProfile_Group::get( $args,  $assoc_args )

Fetch specific XProfile field group.


Description Description

Top ↑

OPTIONS OPTIONS

: Identifier for the field group.
[–fields=] : Limit the output to specific fields.
[–format=] : Render output in a particular format. — default: table options: – table – json – haml —
## EXAMPLES
$ wp bp xprofile group get 500 $ wp bp xprofile group see 56 –format=json


Source Source

File: cli/src/xprofile-group.php

	public function get( $args, $assoc_args ) {
		$field_group_id = $args[0];

		if ( ! is_numeric( $field_group_id ) ) {
			WP_CLI::error( 'Please provide a numeric field group ID.' );
		}

		$object = xprofile_get_field_group( $field_group_id );
		if ( empty( $object->id ) && ! is_object( $object ) ) {
			WP_CLI::error( 'No XProfile field group found.' );
		}

		$object_arr = get_object_vars( $object );
		if ( empty( $assoc_args['fields'] ) ) {
			$assoc_args['fields'] = array_keys( $object_arr );
		}

		$this->get_formatter( $assoc_args )->display_item( $object_arr );
	}


Top ↑

User Contributed Notes User Contributed Notes

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