BP_REST_Group_Settings_Endpoint::get_courses_fields( integer $group_id )
Get Group course Settings.
Description
Parameters
- $group_id
-
(Required) Group ID.
Return
(mixed|void)
Source
File: bp-groups/classes/class-bp-rest-group-settings-endpoint.php
protected function get_courses_fields( $group_id ) {
$fields = array();
buddypress()->groups->current_group = groups_get_group( $group_id );
if ( ! function_exists( 'bp_ld_sync' ) || '1' !== bp_ld_sync( 'settings' )->get( 'buddypress.enabled', true ) ) {
return new WP_Error(
'bp_rest_invalid_group_setting_nav',
__( 'Sorry, you are not allowed to see the courses group settings options.', 'buddyboss' ),
array(
'status' => 400,
)
);
}
$has_ld_group = bp_ld_sync( 'buddypress' )->sync->generator( $group_id )->hasLdGroup();
$fields[] = array(
'label' => esc_html__( 'Group Courses Settings', 'buddyboss' ),
'name' => '',
'description' => esc_html__( 'Create and associate to a LearnDash group, allowing courses and reports to be managed within the group.', 'buddyboss' ),
'field' => 'heading',
'value' => '',
'options' => array(),
);
$fields[] = array(
'label' => esc_html__( 'Yes. I want this group to sync with a LearnDash group.', 'buddyboss' ),
'name' => 'bp-ld-sync-enable',
'description' => '',
'field' => 'checkbox',
'value' => $has_ld_group,
'options' => array(),
);
return apply_filters( 'bp_rest_group_settings_courses', $fields, $group_id );
}
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.