WordPress Social Share, Social Login and Social Comments Plugin – Super Socializer - Version 7.13.40

Version Description

[19 October 2022] = * [Improvement] Youtube login is now fetching profile data from Youtube channel instead of the Google profile

Download this release

Release Info

Developer the_champ
Plugin Icon 128x128 WordPress Social Share, Social Login and Social Comments Plugin – Super Socializer
Version 7.13.40
Comparing to
See all releases

Code changes from version 7.13.39 to 7.13.40

admin/social_login.php CHANGED
@@ -417,6 +417,29 @@
417
  </td>
418
  </tr>
419
  </tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
 
421
  <tbody id="the_champ_vkontakte_options" <?php echo isset($theChampLoginOptions['providers']) && in_array('vkontakte', $theChampLoginOptions['providers']) ? '' : 'style="display:none"'; ?>>
422
  <tr>
417
  </td>
418
  </tr>
419
  </tbody>
420
+
421
+ <tbody id="the_champ_youtube_options" <?php echo isset($theChampLoginOptions['providers']) && in_array('youtube', $theChampLoginOptions['providers']) ? '' : 'style="display:none"'; ?>>
422
+ <tr>
423
+ <th>
424
+ <label for="the_champ_sl_youtube_key"><?php _e("Youtube API Key", 'super-socializer'); ?></label><img id="the_champ_sl_youtube_key_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
425
+ </th>
426
+ <td>
427
+ <input id="the_champ_sl_youtube_key" name="the_champ_login[youtube_key]" type="text" value="<?php echo isset($theChampLoginOptions['youtube_key']) ? $theChampLoginOptions['youtube_key'] : '' ?>" />
428
+ </td>
429
+ </tr>
430
+
431
+ <tr class="the_champ_help_content" id="the_champ_sl_youtube_key_help_cont">
432
+ <td colspan="2">
433
+ <div>
434
+ <?php echo sprintf(__('Required for Youtube Social Login to work. Please follow the documentation at <a href="%s" target="_blank">this link</a> to get Youtube API Key', 'super-socializer'), 'https://support.heateor.com/integrate-youtube-login-with-wordpress') ?>
435
+ <br/>
436
+ <span style="color: #14ACDF"><?php _e('Paste following url in the <strong>AUTHORIZED REDIRECT URI</strong> option mentioned at the link', 'super-socializer'); ?></span>
437
+ <br/>
438
+ <strong style="color: #14ACDF"><?php echo esc_url(home_url()); ?></strong>
439
+ </div>
440
+ </td>
441
+ </tr>
442
+ </tbody>
443
 
444
  <tbody id="the_champ_vkontakte_options" <?php echo isset($theChampLoginOptions['providers']) && in_array('vkontakte', $theChampLoginOptions['providers']) ? '' : 'style="display:none"'; ?>>
445
  <tr>
helper.php CHANGED
@@ -23,6 +23,9 @@ function the_champ_login_notifications($loginOptions){
23
  if(in_array('linkedin', $loginOptions['providers']) && (!isset($loginOptions['li_key']) || $loginOptions['li_key'] == '' || !isset($loginOptions['li_secret']) || $loginOptions['li_secret'] == '')){
24
  $errorHtml .= the_champ_error_message('Specify LinkedIn Client ID and Secret in the <strong>Super Socializer</strong> > <strong>Social Login</strong> section in the admin panel for LinkedIn Login to work');
25
  }
 
 
 
26
  if((in_array('google', $loginOptions['providers']) || in_array('youtube', $loginOptions['providers'])) && (!isset($loginOptions['google_key']) || $loginOptions['google_key'] == '' || !isset($loginOptions['google_secret']) || $loginOptions['google_secret'] == '')){
27
  $errorHtml .= the_champ_error_message('Specify Google Client ID and Secret in the <strong>Super Socializer</strong> > <strong>Social Login</strong> section in the admin panel for Google and Youtube Login to work');
28
  }
23
  if(in_array('linkedin', $loginOptions['providers']) && (!isset($loginOptions['li_key']) || $loginOptions['li_key'] == '' || !isset($loginOptions['li_secret']) || $loginOptions['li_secret'] == '')){
24
  $errorHtml .= the_champ_error_message('Specify LinkedIn Client ID and Secret in the <strong>Super Socializer</strong> > <strong>Social Login</strong> section in the admin panel for LinkedIn Login to work');
25
  }
26
+ if(in_array('youtube', $loginOptions['providers']) && (!isset($loginOptions['youtube_key']) || $loginOptions['youtube_key'] == '')){
27
+ $errorHtml .= the_champ_error_message('Specify Youtube API Key in the <strong>Super Socializer</strong> > <strong>Social Login</strong> section in the admin panel for Youtube Login to work');
28
+ }
29
  if((in_array('google', $loginOptions['providers']) || in_array('youtube', $loginOptions['providers'])) && (!isset($loginOptions['google_key']) || $loginOptions['google_key'] == '' || !isset($loginOptions['google_secret']) || $loginOptions['google_secret'] == '')){
30
  $errorHtml .= the_champ_error_message('Specify Google Client ID and Secret in the <strong>Super Socializer</strong> > <strong>Social Login</strong> section in the admin panel for Google and Youtube Login to work');
31
  }
inc/social_login.php CHANGED
@@ -540,7 +540,7 @@ function the_champ_sanitize_profile_data($profileData, $provider){
540
  $temp['link'] = '';
541
  $temp['avatar'] = isset($profileData['smallAvatar']) && heateor_ss_validate_url($profileData['smallAvatar']) !== false ? trim($profileData['smallAvatar']) : '';
542
  $temp['large_avatar'] = isset($profileData['largeAvatar']) && heateor_ss_validate_url($profileData['largeAvatar']) !== false ? trim($profileData['largeAvatar']) : '';
543
- }elseif($provider == 'google' || $provider == 'youtube'){
544
  $temp['id'] = isset($profileData->sub) ? sanitize_text_field($profileData->sub) : '';
545
  $temp['email'] = isset($profileData->email) ? sanitize_email($profileData->email) : '';
546
  $temp['name'] = isset($profileData->name) ? $profileData->name : '';
@@ -551,6 +551,18 @@ function the_champ_sanitize_profile_data($profileData, $provider){
551
  $temp['link'] = isset($profileData->link) && heateor_ss_validate_url(trim($profileData->link)) !== false ? trim($profileData->link) : '';
552
  $temp['large_avatar'] = isset($profileData->picture) && heateor_ss_validate_url($profileData->picture) !== false ? trim($profileData->picture) : '';
553
  $temp['avatar'] = $temp['large_avatar'] != '' ? $temp['large_avatar'] . '?sz=50' : '';
 
 
 
 
 
 
 
 
 
 
 
 
554
  }elseif($provider == 'vkontakte'){
555
  $temp['id'] = isset($profileData['id']) ? sanitize_text_field($profileData['id']) : '';
556
  $temp['email'] = '';
540
  $temp['link'] = '';
541
  $temp['avatar'] = isset($profileData['smallAvatar']) && heateor_ss_validate_url($profileData['smallAvatar']) !== false ? trim($profileData['smallAvatar']) : '';
542
  $temp['large_avatar'] = isset($profileData['largeAvatar']) && heateor_ss_validate_url($profileData['largeAvatar']) !== false ? trim($profileData['largeAvatar']) : '';
543
+ }elseif($provider == 'google'){
544
  $temp['id'] = isset($profileData->sub) ? sanitize_text_field($profileData->sub) : '';
545
  $temp['email'] = isset($profileData->email) ? sanitize_email($profileData->email) : '';
546
  $temp['name'] = isset($profileData->name) ? $profileData->name : '';
551
  $temp['link'] = isset($profileData->link) && heateor_ss_validate_url(trim($profileData->link)) !== false ? trim($profileData->link) : '';
552
  $temp['large_avatar'] = isset($profileData->picture) && heateor_ss_validate_url($profileData->picture) !== false ? trim($profileData->picture) : '';
553
  $temp['avatar'] = $temp['large_avatar'] != '' ? $temp['large_avatar'] . '?sz=50' : '';
554
+ }elseif($provider == 'youtube'){
555
+ $profileData = $profileData->items[0];
556
+ $temp['id'] = isset($profileData->id) ? sanitize_text_field($profileData->id) : '';
557
+ $temp['email'] = isset($profileData->email) ? sanitize_email($profileData->email) : '';
558
+ $temp['name'] = isset($profileData->snippet) && isset($profileData->snippet->title) ? $profileData->snippet->title : '';
559
+ $temp['username'] = '';
560
+ $temp['first_name'] = '';
561
+ $temp['last_name'] = '';
562
+ $temp['bio'] = isset($profileData->snippet) && isset($profileData->snippet->description) ? $profileData->snippet->description : '';
563
+ $temp['link'] = '';
564
+ $temp['large_avatar'] = isset($profileData->snippet) && isset($profileData->snippet->thumbnails) && isset($profileData->snippet->thumbnails->medium) && isset($profileData->snippet->thumbnails->medium->url) && heateor_ss_validate_url($profileData->snippet->thumbnails->medium->url) !== false ? trim($profileData->snippet->thumbnails->medium->url) : '';
565
+ $temp['avatar'] = isset($profileData->snippet) && isset($profileData->snippet->thumbnails) && isset($profileData->snippet->thumbnails->default) && isset($profileData->snippet->thumbnails->default->url) && heateor_ss_validate_url($profileData->snippet->thumbnails->default->url) !== false ? trim($profileData->snippet->thumbnails->default->url) : '';
566
  }elseif($provider == 'vkontakte'){
567
  $temp['id'] = isset($profileData['id']) ? sanitize_text_field($profileData['id']) : '';
568
  $temp['email'] = '';
js/admin/admin.js CHANGED
@@ -19,10 +19,14 @@ jQuery(document).ready(function() {
19
  }),
20
  jQuery("div.theChampHorizontalSharingProviderContainer").find('input').click(function() {
21
  if(jQuery(this).val() == 'youtube' || jQuery(this).val() == 'google'){
22
- if(jQuery(this).is(":checked")){
23
- jQuery("#the_champ_google_options").css("display", "table-row-group")
 
 
24
  }else if((jQuery(this).val() == 'youtube' && jQuery("div.theChampHorizontalSharingProviderContainer").find('input[value=google]').is(":checked") === false) || (jQuery(this).val() == 'google' && jQuery("div.theChampHorizontalSharingProviderContainer").find('input[value=youtube]').is(":checked") === false)){
25
- jQuery("#the_champ_google_options").css("display", "none")
 
 
26
  }
27
  }else{
28
  jQuery(this).is(":checked") ? jQuery("#the_champ_" + jQuery(this).val() + "_options").css("display", "table-row-group") : jQuery("#the_champ_" + jQuery(this).val() + "_options").css("display", "none")
19
  }),
20
  jQuery("div.theChampHorizontalSharingProviderContainer").find('input').click(function() {
21
  if(jQuery(this).val() == 'youtube' || jQuery(this).val() == 'google'){
22
+ if(jQuery(this).is(":checked") && jQuery(this).val() == 'youtube'){
23
+ jQuery("#the_champ_google_options, #the_champ_youtube_options").css("display", "table-row-group");
24
+ }else if(jQuery(this).is(":checked") && jQuery(this).val() == 'google'){
25
+ jQuery("#the_champ_google_options").css("display", "table-row-group");
26
  }else if((jQuery(this).val() == 'youtube' && jQuery("div.theChampHorizontalSharingProviderContainer").find('input[value=google]').is(":checked") === false) || (jQuery(this).val() == 'google' && jQuery("div.theChampHorizontalSharingProviderContainer").find('input[value=youtube]').is(":checked") === false)){
27
+ jQuery("#the_champ_google_options, #the_champ_youtube_options").css("display", "none")
28
+ }else if(jQuery(this).val() == 'youtube' && !jQuery(this).is(":checked")){
29
+ jQuery("#the_champ_youtube_options").css("display", "none")
30
  }
31
  }else{
32
  jQuery(this).is(":checked") ? jQuery("#the_champ_" + jQuery(this).val() + "_options").css("display", "table-row-group") : jQuery("#the_champ_" + jQuery(this).val() + "_options").css("display", "none")
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.heateor.com/donate?action=Super+Socializer
4
  Tags: social login, social share, line login, social commenting, social comments, social plugin, profile data, social analytics, online identity, social profile storage, single sign-on, social media follow, facebook login, twitter login, linkedin login, google login, vkontakte login, Windows Live Login, Microsoft Login, Wordpress login, Yahoo login, Spotify login, Dribbble login, Kakao login, Github login, Twitch login, Instagram login, dropbox login, foursquare login, disqus login, reddit login, amazon login, stackoverflow login, stack overflow login, discord login, mail.ru login, mailru login, mail ru login, gettr share, parler share, odnoklassniki login, yandex login, odnoklassniki, yandex, odnoklassniki login button, yandex login button, Rutube, Rutube share, Rutube sharing, youtube login
5
  Requires at least: 2.5.0
6
  Tested up to: 6.0.3
7
- Stable tag: 7.13.39
8
  License: GPLv2 or later
9
 
10
  The unique Social Plugin to let you integrate Social Login, Social Share, Social Comments and Social Media follow at your website
@@ -213,6 +213,9 @@ Yes, we can help you with it. Just drop an email at support[ at ]heateor[ dot ]c
213
  8. **Social Commenting**: Disqus Commenting selected
214
 
215
  == Changelog ==
 
 
 
216
  = 7.13.39 [18 October 2022] =
217
  * [New] Added Youtube login
218
  * [Improvement] Updated the Facebook JS SDK being used throughout the plugin to the latest version 15.0
@@ -2509,4 +2512,7 @@ Yes, we can help you with it. Just drop an email at support[ at ]heateor[ dot ]c
2509
  = 7.13.39 [18 October 2022] =
2510
  * [New] Added Youtube login
2511
  * [Improvement] Updated the Facebook JS SDK being used throughout the plugin to the latest version 15.0
2512
- * [Improvement] Admin UI improvements
 
 
 
4
  Tags: social login, social share, line login, social commenting, social comments, social plugin, profile data, social analytics, online identity, social profile storage, single sign-on, social media follow, facebook login, twitter login, linkedin login, google login, vkontakte login, Windows Live Login, Microsoft Login, Wordpress login, Yahoo login, Spotify login, Dribbble login, Kakao login, Github login, Twitch login, Instagram login, dropbox login, foursquare login, disqus login, reddit login, amazon login, stackoverflow login, stack overflow login, discord login, mail.ru login, mailru login, mail ru login, gettr share, parler share, odnoklassniki login, yandex login, odnoklassniki, yandex, odnoklassniki login button, yandex login button, Rutube, Rutube share, Rutube sharing, youtube login
5
  Requires at least: 2.5.0
6
  Tested up to: 6.0.3
7
+ Stable tag: 7.13.40
8
  License: GPLv2 or later
9
 
10
  The unique Social Plugin to let you integrate Social Login, Social Share, Social Comments and Social Media follow at your website
213
  8. **Social Commenting**: Disqus Commenting selected
214
 
215
  == Changelog ==
216
+ = 7.13.40 [19 October 2022] =
217
+ * [Improvement] Youtube login is now fetching profile data from Youtube channel instead of the Google profile
218
+
219
  = 7.13.39 [18 October 2022] =
220
  * [New] Added Youtube login
221
  * [Improvement] Updated the Facebook JS SDK being used throughout the plugin to the latest version 15.0
2512
  = 7.13.39 [18 October 2022] =
2513
  * [New] Added Youtube login
2514
  * [Improvement] Updated the Facebook JS SDK being used throughout the plugin to the latest version 15.0
2515
+ * [Improvement] Admin UI improvements
2516
+
2517
+ = 7.13.40 [19 October 2022] =
2518
+ * [Improvement] Youtube login is now fetching profile data from Youtube channel instead of the Google profile
super_socializer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Super Socializer
4
  Plugin URI: https://super-socializer-wordpress.heateor.com
5
  Description: A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Media follow and more
6
- Version: 7.13.39
7
  Author: Team Heateor
8
  Author URI: https://www.heateor.com
9
  Text Domain: super-socializer
@@ -11,7 +11,7 @@ Domain Path: /languages
11
  License: GPL2+
12
  */
13
  defined('ABSPATH') or die("Cheating........Uh!!");
14
- define('THE_CHAMP_SS_VERSION', '7.13.39');
15
 
16
  // attributes to allow in the HTML of the social share and social media follow icons
17
  $heateorSsDefaultAttribs = array(
@@ -623,15 +623,24 @@ function the_champ_connect(){
623
  die;
624
  }
625
  // Google
626
- }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Google' || sanitize_text_field($_GET['SuperSocializerAuth']) == 'Youtube'){
627
  if(isset($theChampLoginOptions['providers']) && (in_array('google', $theChampLoginOptions['providers']) || in_array('youtube', $theChampLoginOptions['providers'])) && isset($theChampLoginOptions['google_key']) && $theChampLoginOptions['google_key'] != '' && isset($theChampLoginOptions['google_secret']) && $theChampLoginOptions['google_secret'] != ''){
628
  $googleLoginState = mt_rand();
629
  // save referrer url in state
630
  update_user_meta($googleLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
631
- update_user_meta($googleLoginState, 'super_socializer_temp_network', sanitize_text_field($_GET['SuperSocializerAuth']));
632
  wp_redirect("https://accounts.google.com/o/oauth2/auth?client_id=" . $theChampLoginOptions['google_key'] . "&scope=https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile&state=". $googleLoginState ."&response_type=code&prompt=select_account&redirect_uri=" . home_url());
633
  die;
634
  }
 
 
 
 
 
 
 
 
 
635
  }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Twitter' && !isset($_REQUEST['oauth_token'])){
636
  if(isset($theChampLoginOptions['twitter_key']) && $theChampLoginOptions['twitter_key'] != '' && isset($theChampLoginOptions['twitter_secret']) && $theChampLoginOptions['twitter_secret'] != ''){
637
  if(!function_exists('curl_init')){
@@ -1906,8 +1915,15 @@ function the_champ_connect(){
1906
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1907
  $body = json_decode(wp_remote_retrieve_body($response));
1908
  if(isset($body->access_token)){
 
 
 
 
 
 
 
1909
  $authorization = "Bearer " . $body->access_token;
1910
- $response = wp_remote_get('https://www.googleapis.com/oauth2/v3/userinfo', array(
1911
  'timeout' => 15,
1912
  'headers' => array(
1913
  'Accept' => 'application/json',
@@ -1916,9 +1932,25 @@ function the_champ_connect(){
1916
  ));
1917
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1918
  $profileData = json_decode(wp_remote_retrieve_body($response));
1919
- if(is_object($profileData) && isset($profileData->sub)){
1920
- $googleLoginState = sanitize_text_field($_GET['state']);
1921
- $network = get_user_meta($googleLoginState, 'super_socializer_temp_network', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1922
  $profileData = the_champ_sanitize_profile_data($profileData, strtolower($network));
1923
  $googleRedirectUrl = get_user_meta($googleLoginState, 'super_socializer_redirect_to', true);
1924
  $response = the_champ_user_auth($profileData, strtolower($network), $googleRedirectUrl);
@@ -2763,6 +2795,7 @@ function the_champ_save_default_options(){
2763
  'odnoklassniki_public_key' => '',
2764
  'yandex_client_id' => '',
2765
  'yandex_client_secret' => '',
 
2766
  'same_tab_login' => '1',
2767
  'allow_cyrillic' => array()
2768
  ));
@@ -3378,6 +3411,12 @@ function the_champ_update_db_check(){
3378
  $currentVersion = get_option('the_champ_ss_version');
3379
 
3380
  if($currentVersion && $currentVersion != THE_CHAMP_SS_VERSION){
 
 
 
 
 
 
3381
  if(version_compare("7.13.37", $currentVersion) > 0){
3382
  global $theChampSharingOptions, $theChampLoginOptions;
3383
  $theChampSharingOptions['rutube_url'] = '';
3
  Plugin Name: Super Socializer
4
  Plugin URI: https://super-socializer-wordpress.heateor.com
5
  Description: A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Media follow and more
6
+ Version: 7.13.40
7
  Author: Team Heateor
8
  Author URI: https://www.heateor.com
9
  Text Domain: super-socializer
11
  License: GPL2+
12
  */
13
  defined('ABSPATH') or die("Cheating........Uh!!");
14
+ define('THE_CHAMP_SS_VERSION', '7.13.40');
15
 
16
  // attributes to allow in the HTML of the social share and social media follow icons
17
  $heateorSsDefaultAttribs = array(
623
  die;
624
  }
625
  // Google
626
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Google'){
627
  if(isset($theChampLoginOptions['providers']) && (in_array('google', $theChampLoginOptions['providers']) || in_array('youtube', $theChampLoginOptions['providers'])) && isset($theChampLoginOptions['google_key']) && $theChampLoginOptions['google_key'] != '' && isset($theChampLoginOptions['google_secret']) && $theChampLoginOptions['google_secret'] != ''){
628
  $googleLoginState = mt_rand();
629
  // save referrer url in state
630
  update_user_meta($googleLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
631
+ update_user_meta($googleLoginState, 'super_socializer_temp_network', 'Google');
632
  wp_redirect("https://accounts.google.com/o/oauth2/auth?client_id=" . $theChampLoginOptions['google_key'] . "&scope=https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile&state=". $googleLoginState ."&response_type=code&prompt=select_account&redirect_uri=" . home_url());
633
  die;
634
  }
635
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Youtube'){
636
+ if(isset($theChampLoginOptions['providers']) && in_array('youtube', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['youtube_key']) && $theChampLoginOptions['youtube_key'] != '' && isset($theChampLoginOptions['google_key']) && $theChampLoginOptions['google_key'] != '' && isset($theChampLoginOptions['google_secret']) && $theChampLoginOptions['google_secret'] != ''){
637
+ $youtubeLoginState = mt_rand();
638
+ // save referrer url in state
639
+ update_user_meta($youtubeLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
640
+ update_user_meta($youtubeLoginState, 'super_socializer_temp_network', 'Youtube');
641
+ wp_redirect("https://accounts.google.com/o/oauth2/auth?client_id=" . $theChampLoginOptions['google_key'] . "&scope=https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/youtube.readonly&state=". $youtubeLoginState ."&response_type=code&prompt=select_account&redirect_uri=" . home_url());
642
+ die;
643
+ }
644
  }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Twitter' && !isset($_REQUEST['oauth_token'])){
645
  if(isset($theChampLoginOptions['twitter_key']) && $theChampLoginOptions['twitter_key'] != '' && isset($theChampLoginOptions['twitter_secret']) && $theChampLoginOptions['twitter_secret'] != ''){
646
  if(!function_exists('curl_init')){
1915
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1916
  $body = json_decode(wp_remote_retrieve_body($response));
1917
  if(isset($body->access_token)){
1918
+ $googleLoginState = sanitize_text_field($_GET['state']);
1919
+ $network = get_user_meta($googleLoginState, 'super_socializer_temp_network', true);
1920
+ if($network == 'Google'){
1921
+ $api = 'https://www.googleapis.com/oauth2/v3/userinfo';
1922
+ }else{
1923
+ $api = 'https://youtube.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&mine=true&key='. $theChampLoginOptions['youtube_key'];
1924
+ }
1925
  $authorization = "Bearer " . $body->access_token;
1926
+ $response = wp_remote_get($api, array(
1927
  'timeout' => 15,
1928
  'headers' => array(
1929
  'Accept' => 'application/json',
1932
  ));
1933
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1934
  $profileData = json_decode(wp_remote_retrieve_body($response));
1935
+ if($network == 'Youtube'){
1936
+ $authorization = "Bearer " . $body->access_token;
1937
+ $response = wp_remote_get('https://www.googleapis.com/oauth2/v3/userinfo', array(
1938
+ 'timeout' => 15,
1939
+ 'headers' => array(
1940
+ 'Accept' => 'application/json',
1941
+ 'Authorization' => $authorization
1942
+ )
1943
+ ));
1944
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1945
+ $emailProfileData = json_decode(wp_remote_retrieve_body($response));
1946
+ if(is_object($emailProfileData) && isset($emailProfileData->email_verified) && $emailProfileData->email_verified == 1 && isset($emailProfileData->email)){
1947
+ $profileData = (array) $profileData;
1948
+ $profileData['email'] = $emailProfileData->email;
1949
+ $profileData = (object) $profileData;
1950
+ }
1951
+ }
1952
+ }
1953
+ if(is_object($profileData) && (($network == 'Google' && isset($profileData->sub)) || ($network == 'Youtube' && isset($profileData->items) && is_array($profileData->items) && isset($profileData->items[0]) && isset($profileData->items[0]->id)))){
1954
  $profileData = the_champ_sanitize_profile_data($profileData, strtolower($network));
1955
  $googleRedirectUrl = get_user_meta($googleLoginState, 'super_socializer_redirect_to', true);
1956
  $response = the_champ_user_auth($profileData, strtolower($network), $googleRedirectUrl);
2795
  'odnoklassniki_public_key' => '',
2796
  'yandex_client_id' => '',
2797
  'yandex_client_secret' => '',
2798
+ 'youtube_key' => '',
2799
  'same_tab_login' => '1',
2800
  'allow_cyrillic' => array()
2801
  ));
3411
  $currentVersion = get_option('the_champ_ss_version');
3412
 
3413
  if($currentVersion && $currentVersion != THE_CHAMP_SS_VERSION){
3414
+ if(version_compare("7.13.40", $currentVersion) > 0){
3415
+ global $theChampLoginOptions;
3416
+ $theChampLoginOptions['youtube_key'] = '';
3417
+ update_option('the_champ_login', $theChampLoginOptions);
3418
+ }
3419
+
3420
  if(version_compare("7.13.37", $currentVersion) > 0){
3421
  global $theChampSharingOptions, $theChampLoginOptions;
3422
  $theChampSharingOptions['rutube_url'] = '';