BP_REST_XProfile_Fields_Endpoint:: get_repeater_fields_data (BP_XProfile_Field美元的领域WP_REST_Request美元的请求

获取中继器字段数据。

描述

参数

美元的领域

BP_XProfile_Field(必需)领域对象。

美元的请求

WP_REST_Request(必需)关于请求的完整数据。

返回

(数组|空白)

文件:bp-xprofile /类/ class-bp-rest-xprofile-fields-endpoint.php

Public function get_repeater_fields_data($field, $request) {global $bp, $wpdb;If (empty($field) || !Bp_loggedin_user_id()){返回;} $field_id = $field->id;// php:忽略$sql = "select m1. php . php "object_id FROM {$bp->profile->table_name_meta}meta_key = '_cloned_from' AND m1。meta_value = % d”;// phpcs:忽略$sql = $wpdb->准备($sql, $field_id);// phpcs:忽略$wpdb->get_col($sql);$user_id = (!($request['user_id']) ? $request['user_id'] : bp_loggedin_user_id() ); $data = array(); $user_fields = bp_get_profile_field_set_count( $field->group_id, $user_id ); if ( ! empty( $results ) && ! is_wp_error( $results ) ) { $count = 1; foreach ( $results as $k => $sub_field_id ) { if ( $count > $user_fields ) { break; } $data[ $k ]['id'] = $sub_field_id; if ( ! empty( $request['fetch_field_data'] ) ) { $data[ $k ]['value'] = array( 'raw' => xprofile_get_field_data( $sub_field_id, $user_id ), 'unserialized' => $this->get_profile_field_unserialized_value( xprofile_get_field_data( $sub_field_id, $user_id ) ), 'rendered' => $this->get_profile_field_rendered_value( xprofile_get_field_data( $sub_field_id, $user_id ), $field_id ), ); } if ( ! empty( $request['fetch_visibility_level'] ) ) { $data[ $k ]['visibility_level'] = xprofile_get_field_visibility_level( $sub_field_id, $user_id ); $data[ $k ]['allow_custom_visibility'] = bp_xprofile_get_meta( $sub_field_id, 'field', 'allow_custom_visibility' ); } $count ++; } } return $data; }

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队