BP_BuddyBoss_Platform_Updater::update_plugin( $transient )
Description
Source
File: bp-core/classes/class-bp-buddyboss-platform-updater.php
function update_plugin( $transient ) {
if ( empty( $transient->checked ) || empty( $transient->checked[ $this->plugin_path ] ) ) {
return $transient;
}
$request_data = array(
'id' => $this->plugin_id,
'slug' => $this->plugin_slug,
'version' => $transient->checked[ $this->plugin_path ]
);
if ( ! empty( $this->license ) ) {
$request_data['license'] = $this->license;
}
$request_string = $this->request_call( 'update_check', $request_data );
$raw_response = wp_remote_post( $this->api_url, $request_string );
$response = null;
if ( ! is_wp_error( $raw_response ) && ( $raw_response['response']['code'] == 200 ) ) {
$response = unserialize( $raw_response['body'] );
}
//Feed the candy
if ( is_object( $response ) && ! empty( $response ) ) {
$transient->response[ $this->plugin_path ] = $response;
return $transient;
}
// If there is any same plugin from wordpress.org repository then unset it.
if ( isset( $transient->response[ $this->plugin_path ] ) ) {
if ( strpos( $transient->response[ $this->plugin_path ]->package, 'wordpress.org' ) !== false ) {
unset( $transient->response[ $this->plugin_path ] );
}
}
return $transient;
}
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.