BP_REST_Settings_Endpoint::get_items( WP_REST_Request $request )
Retrieve settings.
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response) | WP_Error
Source
File: bp-core/classes/class-bp-rest-settings-endpoint.php
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | public function get_items( $request ) { $args = array (); /** * Filter the query arguments for the request. * * @param array $args Key value array of query var to query value. * @param WP_REST_Request $request The request sent to the API. * * @since 0.1.0 */ $args = apply_filters( 'bp_rest_settings_get_items_query_args' , $args , $request ); $bp_plugin_file = 'buddypress/bp-loader.php' ; $bb_plugin_file = 'bbpress/bbpress.php' ; $buddyboss_platform_plugin_file = 'buddyboss-platform/bp-loader.php' ; $results = array (); if ( ! function_exists( 'is_plugin_active' ) ) { include_once ABSPATH . 'wp-admin/includes/plugin.php' ; } // Check BuddyBoss Platform activate and get the settings. if ( is_plugin_active( $buddyboss_platform_plugin_file ) ) { $platform_settings = $this ->get_buddyboss_platform_settings(); $results [ 'platform' ] = apply_filters( 'bp_rest_platform_settings' , $platform_settings ); } else { // Check BuddyPress activate and get the settings. if ( is_plugin_active( $bp_plugin_file ) ) { $buddypress_settings = $this ->get_buddypress_settings(); $results [ 'buddypress' ] = apply_filters( 'bp_rest_buddypress_settings' , $buddypress_settings ); } // Check bbPress activate and get the settings. if ( is_plugin_active( $bb_plugin_file ) ) { $bbpress_settings = $this ->get_bbpress_settings(); $results [ 'bbpress' ] = apply_filters( 'bp_rest_bbpress_settings' , $bbpress_settings ); } } $response = rest_ensure_response( $results ); /** * Fires after a list of settings is fetched via the REST API. * * @param WP_REST_Response $response The response data. * @param WP_REST_Request $request The request sent to the API. * * @since 0.1.0 */ do_action( 'bp_rest_settings_get_items' , $response , $request ); return $response ; } |
Changelog
Version | Description |
---|---|
0.1.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.