Skip to content

Commit e33beb8

Browse files
author
themefuse
committed
action fired when ext. settings are saved, was renamed
1 parent 9a9ff78 commit e33beb8

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

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

+16-21
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,34 @@ public function _init() {
1717
}
1818

1919
private function add_actions() {
20-
add_action( 'fw_extension_settings_form_saved', array(
20+
add_action( 'fw_extension_settings_form_saved:'. $this->get_parent()->get_name(), array(
2121
$this,
2222
'_action_fw_ext_social_facebook_save_options'
23-
), 10, 2 );
23+
), 10 );
2424
}
2525

2626
private function add_filters() {
2727
add_filter( 'fw_ext_social_tabs', array( $this, '_filter_fw_ext_social_tabs' ) );
2828
}
2929

3030
/**
31-
* @param $extension_name
3231
* @param $options_before_save
3332
*/
34-
public function _action_fw_ext_social_facebook_save_options( $extension_name, $options_before_save ) {
33+
public function _action_fw_ext_social_facebook_save_options( $options_before_save ) {
3534
$parent = $this->get_parent()->get_name();
36-
37-
if ( $extension_name === $parent ) {
38-
39-
$response = wp_remote_get(
40-
add_query_arg(
41-
array(
42-
'grant_type' => 'client_credentials',
43-
'client_id' => fw_get_db_ext_settings_option( $parent, 'facebook-app-id' ),
44-
'client_secret' => fw_get_db_ext_settings_option( $parent, 'facebook-app-secret' )
45-
), 'https://graph.facebook.com/oauth/access_token' ) );
46-
$body = wp_remote_retrieve_body( $response );
47-
if ( strpos( $body, 'access_token=' ) !== false ) {
48-
$token = substr( $body, 13 );
49-
fw_set_db_extension_data( $this->get_name(), $this->access_token_name, $token );
50-
} else {
51-
fw_set_db_extension_data( $this->get_name(), $this->access_token_name, false );
52-
}
35+
$response = wp_remote_get(
36+
add_query_arg(
37+
array(
38+
'grant_type' => 'client_credentials',
39+
'client_id' => fw_get_db_ext_settings_option( $parent, 'facebook-app-id' ),
40+
'client_secret' => fw_get_db_ext_settings_option( $parent, 'facebook-app-secret' )
41+
), '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 );
46+
} else {
47+
fw_set_db_extension_data( $this->get_name(), $this->access_token_name, false );
5348
}
5449
}
5550

0 commit comments

Comments
 (0)