Skip to content

Commit ce450c3

Browse files
committed
Fixed #3
1 parent e39abb1 commit ce450c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extensions/social-facebook/class-fw-extension-social-facebook.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public function _action_fw_ext_social_facebook_save_options( $options_before_sav
3939
'client_id' => fw_get_db_ext_settings_option( $parent, 'facebook-app-id' ),
4040
'client_secret' => fw_get_db_ext_settings_option( $parent, 'facebook-app-secret' )
4141
), 'https://graph.facebook.com/oauth/access_token' ) );
42-
$body = wp_remote_retrieve_body( $response );
43-
if ( strpos( $body, 'access_token=' ) !== false ) {
44-
$token = substr( $body, 13 );
45-
fw_set_db_extension_data( $this->get_name(), $this->access_token_name, $token );
42+
$body = json_decode( wp_remote_retrieve_body( $response ), true );
43+
44+
if ( isset( $body['access_token'] ) ) {
45+
fw_set_db_extension_data( $this->get_name(), $this->access_token_name, $body['access_token'] );
4646
} else {
4747
fw_set_db_extension_data( $this->get_name(), $this->access_token_name, false );
4848
}

0 commit comments

Comments
 (0)