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

Get activity items, as specified by parameters.

Description

See also

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 profile 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.
  • 'include_fields'
    (array) Include these fields.
  • 'hide_empty_fields'
    (int|bool) Should empty fields be skipped.
  • 'fetch_visibility_level'
    (int|bool) Fetch visibility levels.
  • 'update_meta_cache'
    (int|bool) Should metadata cache be updated.

Default value: ''

Source

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

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
public function __construct( $args = '' ) {
 
    // Backward compatibility with old method of passing arguments.
    if ( ! is_array( $args ) || func_num_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.', 'buddyboss' ), __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, func_get_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'];
}

Changelog

Changelog
Version Description
BuddyPress 1.5.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.