BP_REST_Group_Settings_Endpoint:: update_courses_fields (WP_REST_Request美元的请求)
更新组课程设置。
描述
参数
- 美元的请求
-
(WP_REST_Request)(必需)用于生成响应的请求。
返回
(数组)
源
文件:bp-groups /类/ class-bp-rest-group-settings-endpoint.php
update_courses_fields($request) {$post_fields = $request->get_param('fields');$group_id = $request->get_param('id');$group = group_get_group ($group_id);buddypress() - >组- > current_group =美元集团;如果(!Function_exists ('bp_ld_sync') || '1' !== bp_ld_sync('settings')->get(' ld_sync');{return new WP_Error('bp_rest_invalid_group_setting_nav', __('对不起,您不允许更新课程组设置选项。', 'buddyboss'), array('status' => 400,));}如果(空(post_fields美元)){返回数组(的错误 ' => '', ' 请注意 ' => '', );} $generator = bp_ld_sync('buddypress')->sync->generator($group_id);if (array_key_exists('bp-ld-sync-enable', (array) $post_fields) && empty($post_fields['bp-ld-sync-enable'])) {$generator->desyncFromLearndash(); } elseif ( array_key_exists( 'bp-ld-sync-enable', (array) $post_fields ) && ! empty( $post_fields['bp-ld-sync-enable'] ) ) { $generator->associateToLearndash()->syncBpAdmins(); } $notice = __( 'Group settings were successfully updated.', 'buddyboss' ); return array( 'error' => '', 'notice' => $notice, ); }