bp_xprofile_get_selected_options_user_progress (数组美元的设置

函数将根据您提供的设置返回用户进度。

描述

参数

美元的设置

数组(必需)fieldset的设置,选择显示在进展中&个人资料或封面照片选择显示在进展中。

返回

(数组)$响应基于小部件设置的用户进度。

文件:bp-core / bp-core-functions.php

函数bp_xprofile_get_selected_options_user_progress($settings) {$profile_groups = $settings['profile_groups'];profile_photo_type =美元设置(“profile_photo_type”);//登录用户进程。$get_user_data = bp_get_user_meta(get_current_user_id(), 'bp_profile_completion_widgets', true);如果(!$get_user_data) {bp_core_xprofile_update_profile_completion_user_progress();$get_user_data = bp_get_user_meta(get_current_user_id(), 'bp_profile_completion_widgets', true);} $response = array();$响应[' photo_type '] =数组();美元的反应(“集团”)=()数组; $response['total_fields'] = 0; $response['completed_fields'] = 0; $total_count = 0; $total_completed_count = 0; if ( ! empty( $profile_photo_type ) ) { foreach ( $profile_photo_type as $option ) { if ( 'profile_photo' === $option && isset( $get_user_data['photo_type'] ) && isset( $get_user_data['photo_type']['profile_photo'] ) ) { $response['photo_type']['profile_photo'] = $get_user_data['photo_type']['profile_photo']; $total_count = ++ $total_count; if ( isset( $get_user_data['photo_type']['profile_photo']['is_uploaded'] ) && 1 === (int) $get_user_data['photo_type']['profile_photo']['is_uploaded'] ) { $total_completed_count = ++ $total_completed_count; } } elseif ( 'cover_photo' === $option && isset( $get_user_data['photo_type'] ) && isset( $get_user_data['photo_type']['cover_photo'] ) ) { $response['photo_type']['cover_photo'] = $get_user_data['photo_type']['cover_photo']; $total_count = ++ $total_count; if ( isset( $get_user_data['photo_type']['cover_photo']['is_uploaded'] ) && 1 === (int) $get_user_data['photo_type']['cover_photo']['is_uploaded'] ) { $total_completed_count = ++ $total_completed_count; } } } } if ( ! empty( $profile_groups ) ) { foreach ( $profile_groups as $group ) { if ( isset( $get_user_data['groups'][ $group ] ) ) { $response['groups'][ $group ] = $get_user_data['groups'][ $group ]; $total_count = $total_count + (int) $get_user_data['groups'][ $group ]['group_total_fields']; if ( isset( $get_user_data['groups'][ $group ]['group_completed_fields'] ) && (int) $get_user_data['groups'][ $group ]['group_completed_fields'] > 0 ) { $total_completed_count = $total_completed_count + (int) $get_user_data['groups'][ $group ]['group_completed_fields']; } } } } if ( $total_count > 0 ) { $response['total_fields'] = $total_count; } if ( $total_completed_count > 0 ) { $response['completed_fields'] = $total_completed_count; } /** * Filters will return the user progress based on the settings you provided. * * @param array $response user progress array. * @param array $profile_groups user profile groups. * @param array $profile_photo_type user profile photo/cover data. * @param array $get_user_data user profile cached data. * * @since BuddyBoss 1.5.4 * */ return apply_filters( 'bp_xprofile_get_selected_options_user_progress', $response, $profile_groups, $profile_photo_type, $get_user_data ); }

问题吗?

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