BP_XProfile_Data_Template::__construct( array|string $args = '' )

Get activity items, as specified by parameters.


Description Description

See also See also


Top ↑

Parameters Parameters

$args

(Optional) An array of arguments. All items are optional.

  • 'user_id'
    (int) Fetch field data for this user ID.
  • 'member_type'
    (string|array) Limit results to those matching member type(s).
  • 'profile_group_id'
    (int) Field group to fetch fields & data for.
  • 'hide_empty_groups'
    (int|bool) Should empty field groups be skipped.
  • 'fetch_fields'
    (int|bool) Fetch fields for field group.
  • 'fetch_field_data'
    (int|bool) Fetch field data for fields in group.
  • 'exclude_groups'
    (array) Exclude these field groups.
  • 'exclude_fields'
    (array) Exclude these fields.
  • 'hide_empty_fields'
    (int|bool) Should empty fields be skipped.
  • 'fetch_visibility_level'
    (int|bool) Fetch visibility levels.
  • 'hide_field_types'
    (string[]) List of field types to hide form loop. Default: empty array.
  • 'signup_fields_only'
    (bool) Whether to only return signup fields. Default: false.
  • 'update_meta_cache'
    (int|bool) Should metadata cache be updated.

Default value: ''


Top ↑

Source Source

File: bp-xprofile/classes/class-bp-xprofile-data-template.php

	public function __construct( $args = '' ) {
		$function_args = func_get_args();

		// Backward compatibility with old method of passing arguments.
		if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
			_deprecated_argument( __METHOD__, '2.3.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );

			$old_args_keys = array(
				0 => 'user_id',
				1 => 'profile_group_id',
				2 => 'hide_empty_groups',
				3 => 'fetch_fields',
				4 => 'fetch_field_data',
				5 => 'exclude_groups',
				6 => 'exclude_fields',
				7 => 'hide_empty_fields',
				8 => 'fetch_visibility_level',
				9 => 'update_meta_cache'
			);

			$args = bp_core_parse_args_array( $old_args_keys, $function_args );
		}

		$r = wp_parse_args( $args, array(
			'profile_group_id'       => false,
			'user_id'                => false,
			'member_type'            => 'any',
			'hide_empty_groups'      => false,
			'hide_empty_fields'      => false,
			'fetch_fields'           => false,
			'fetch_field_data'       => false,
			'fetch_visibility_level' => false,
			'exclude_groups'         => false,
			'exclude_fields'         => false,
			'update_meta_cache'      => true
		) );

		$this->groups      = bp_xprofile_get_groups( $r );
		$this->group_count = count( $this->groups );
		$this->user_id     = $r['user_id'];
	}

Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced $hide_field_types & $signup_fields_only arguments.
2.4.0 Introduced $member_type argument.
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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