Skip to content

Commit

Permalink
Merge pull request #48 from xylusthemes/fb_api_change
Browse files Browse the repository at this point in the history
Change facebook api version
  • Loading branch information
Rajat1192 authored Apr 20, 2024
2 parents 44e369a + a319047 commit 5889fab
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 8 deletions.
Binary file added .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-1880x609.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions includes/class-xt-facebook-events-facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct() {
$xtfe_user_token_options = get_option( 'xtfe_user_token_options', array() );
$this->fb_app_id = isset( $options['facebook_app_id'] ) ? $options['facebook_app_id'] : '';
$this->fb_app_secret = isset( $options['facebook_app_secret'] ) ? $options['facebook_app_secret'] : '';
$this->fb_graph_url = 'https://graph.facebook.com/v15.0/';
$this->fb_graph_url = 'https://graph.facebook.com/v19.0/';
$this->fb_access_token = isset( $xtfe_user_token_options['access_token'] ) ? $xtfe_user_token_options['access_token'] : '';
add_shortcode( 'wpfb_events', array( $this, 'render_facebook_events' ) );
add_action( 'admin_post_xtfe_clear_cache', array( $this, 'xtfe_clear_events_cache' ) );
Expand Down Expand Up @@ -451,12 +451,12 @@ public function get_events_for_facebook_page( $facebook_args ) {
}

$page_token = false;
$user_fb_pages = get_option('xtfe_fb_user_pages', array() );
$user_fb_pages = get_option('xtfe_user_token_options', array() );
if( !empty( $user_fb_pages ) ){
$page_data = $this->get_organizer_name_by_id( $facebook_page_id, true );
if( isset( $page_data->id ) && isset( $user_fb_pages[$page_data->id] ) ){
if( isset( $user_fb_pages[$page_data->id]['access_token'] ) && $user_fb_pages[$page_data->id]['access_token'] !== ''){
$page_token = $user_fb_pages[$page_data->id]['access_token'];
if( isset( $page_data->id ) && isset( $user_fb_pages['access_token'] ) ){
if( isset( $user_fb_pages['access_token'] ) && $user_fb_pages['access_token'] !== ''){
$page_token = $user_fb_pages['access_token'];
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions includes/class-xt-facebook-events-fb-authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ function xtfe_facebook_authorize_user() {
$app_id = isset( $xtfe_options['facebook_app_id'] ) ? $xtfe_options['facebook_app_id'] : '';
$app_secret = isset( $xtfe_options['facebook_app_secret'] ) ? $xtfe_options['facebook_app_secret'] : '';
$redirect_url = admin_url( 'admin-post.php?action=xtfe_facebook_authorize_callback' );
$api_version = 'v15.0';
$api_version = 'v19.0';
$param_url = urlencode($redirect_url);
$xtfe_session_state = md5(uniqid(rand(), TRUE));
setcookie("xtfe_session_state", $xtfe_session_state, "0", "/");

if( $app_id != '' && $app_secret != '' ){

$dialog_url = "https://www.facebook.com/" . $api_version . "/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . $param_url . "&state=" . $xtfe_session_state . "&scope=groups_access_member_info,user_events,pages_show_list,pages_manage_metadata,pages_read_engagement,pages_read_user_content";
$dialog_url = "https://www.facebook.com/" . $api_version . "/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . $param_url . "&state=" . $xtfe_session_state . "&scope=pages_show_list,pages_manage_metadata,pages_read_engagement,pages_read_user_content,page_events";
header("Location: " . $dialog_url);

}else{
Expand All @@ -66,7 +66,7 @@ function xtfe_facebook_authorize_user_callback() {
$app_id = isset( $xtfe_options['facebook_app_id'] ) ? $xtfe_options['facebook_app_id'] : '';
$app_secret = isset( $xtfe_options['facebook_app_secret'] ) ? $xtfe_options['facebook_app_secret'] : '';
$redirect_url = admin_url('admin-post.php?action=xtfe_facebook_authorize_callback');
$api_version = 'v15.0';
$api_version = 'v19.0';
$param_url = urlencode($redirect_url);

if( $app_id != '' && $app_secret != '' ){
Expand Down

0 comments on commit 5889fab

Please sign in to comment.