BP_BuddyBoss_Platform_Updater::plugins_api( $def, $action, $args )
Description
Source
File: bp-core/classes/class-bp-buddyboss-platform-updater.php
function plugins_api( $def, $action, $args ) {
if ( ! isset( $args->slug ) || $args->slug != $this->plugin_slug ) {
return $def;
}
$plugin_info = get_site_transient( 'update_plugins' );
$request_data = array(
'id' => $this->plugin_id,
'slug' => $this->plugin_slug,
'version' => ( isset( $plugin_info->checked ) ) ? $plugin_info->checked[ $this->plugin_path ] : 0
// Current version
);
if ( ! empty( $this->license ) ) {
$request_data['license'] = $this->license;
}
$request_string = $this->request_call( $action, $request_data );
$raw_response = wp_remote_post( $this->api_url, $request_string );
if ( is_wp_error( $raw_response ) ) {
$res = new WP_Error( 'plugins_api_failed', __( 'An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>', 'buddyboss' ), $raw_response->get_error_message() );
} else {
$res = unserialize( $raw_response['body'] );
if ( $res === false ) {
$res = new WP_Error( 'plugins_api_failed', __( 'An unknown error occurred', 'buddyboss' ), $raw_response['body'] );
}
}
return $res;
}
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.