Nextend Social Login and Register (Facebook, Google, Twitter) - Version 3.0.11

Version Description

  • Fix: Twitter - 32bit and Windows servers are lost the id precision
  • Feature: Jetpack SSO login form extension
  • Feature: Prevent external redirect
  • Feature: Added Debug menu and Provider connection test
  • Theme My Login version 7 breaks Nextend Social Login, so notice displays with details

  • PRO: Feature: Sync Google fields

  • PRO: Feature: Sync Twitter fields

Download this release

Release Info

Developer nextendweb
Plugin Icon 128x128 Nextend Social Login and Register (Facebook, Google, Twitter)
Version 3.0.11
Comparing to
See all releases

Code changes from version 3.0.10 to 3.0.11

admin/EditUser.php CHANGED
@@ -4,6 +4,7 @@
4
 
5
  <?php foreach (NextendSocialLogin::$enabledProviders AS $provider): ?>
6
  <?php
 
7
  if (!$provider->isUserConnected($user->ID)) continue;
8
  $hasData = false;
9
  ob_start();
@@ -18,7 +19,8 @@
18
  <th><label><?php echo $fieldData['label'] ?></label></th>
19
  <td>
20
  <?php
21
- $value = get_user_meta($user->ID, $fieldName, true);
 
22
  if (!empty($value)) {
23
  $unSerialized = maybe_unserialize($value);
24
  if (is_array($unSerialized) || is_object($unSerialized)) {
4
 
5
  <?php foreach (NextendSocialLogin::$enabledProviders AS $provider): ?>
6
  <?php
7
+ $settings = $provider->settings;
8
  if (!$provider->isUserConnected($user->ID)) continue;
9
  $hasData = false;
10
  ob_start();
19
  <th><label><?php echo $fieldData['label'] ?></label></th>
20
  <td>
21
  <?php
22
+ $meta_key = $settings->get('sync_fields/fields/' . $fieldName . '/meta_key');
23
+ $value = get_user_meta($user->ID, $meta_key, true);
24
  if (!empty($value)) {
25
  $unSerialized = maybe_unserialize($value);
26
  if (is_array($unSerialized) || is_object($unSerialized)) {
admin/admin.php CHANGED
@@ -65,8 +65,11 @@ class NextendSocialLoginAdmin {
65
  case 'domain-changed':
66
  self::display_admin_area('domain-changed');
67
  break;
68
- case 'show-debug':
69
- self::display_admin_area('show-debug');
 
 
 
70
  break;
71
  case 'global-settings':
72
  self::display_admin_area('global-settings');
@@ -119,6 +122,13 @@ class NextendSocialLoginAdmin {
119
  if (!self::isPro() && NextendSocialLogin::$settings->get('woocommerce_dismissed') == 0 && class_exists('woocommerce', false) && count(NextendSocialLogin::$enabledProviders)) {
120
  add_action('admin_notices', 'NextendSocialLoginAdmin::show_woocommerce_notice');
121
  }
 
 
 
 
 
 
 
122
  }
123
 
124
  if (isset($_GET['page']) && $_GET['page'] == 'nextend-social-login') {
@@ -332,6 +342,7 @@ class NextendSocialLoginAdmin {
332
  case 'store_email':
333
  case 'avatar_store':
334
  case 'store_access_token':
 
335
  if ($value == 1) {
336
  $newData[$key] = 1;
337
  } else {
@@ -438,7 +449,7 @@ class NextendSocialLoginAdmin {
438
  }
439
  }
440
 
441
- private static $endpoint = 'https://secure.nextendweb.com/wp-json/nextend-api/v2/';
442
 
443
  public static function getEndpoint($action = '') {
444
  return self::$endpoint . 'product/nsl/' . urlencode($action);
@@ -553,6 +564,13 @@ class NextendSocialLoginAdmin {
553
  </div>';
554
  }
555
 
 
 
 
 
 
 
 
556
  public static function isPro() {
557
  return apply_filters('nsl-pro', false);
558
  }
65
  case 'domain-changed':
66
  self::display_admin_area('domain-changed');
67
  break;
68
+ case 'debug':
69
+ self::display_admin_area('debug');
70
+ break;
71
+ case 'test-connection':
72
+ self::display_admin_area('test-connection');
73
  break;
74
  case 'global-settings':
75
  self::display_admin_area('global-settings');
122
  if (!self::isPro() && NextendSocialLogin::$settings->get('woocommerce_dismissed') == 0 && class_exists('woocommerce', false) && count(NextendSocialLogin::$enabledProviders)) {
123
  add_action('admin_notices', 'NextendSocialLoginAdmin::show_woocommerce_notice');
124
  }
125
+
126
+
127
+ if (defined('THEME_MY_LOGIN_VERSION') && version_compare(THEME_MY_LOGIN_VERSION, '7.0.0', '>=')) {
128
+ if (!NextendSocialLogin::getRegisterFlowPage() || !NextendSocialLogin::getProxyPage()) {
129
+ add_action('admin_notices', 'NextendSocialLoginAdmin::show_theme_my_login_notice');
130
+ }
131
+ }
132
  }
133
 
134
  if (isset($_GET['page']) && $_GET['page'] == 'nextend-social-login') {
342
  case 'store_email':
343
  case 'avatar_store':
344
  case 'store_access_token':
345
+ case 'redirect_prevent_external':
346
  if ($value == 1) {
347
  $newData[$key] = 1;
348
  } else {
449
  }
450
  }
451
 
452
+ private static $endpoint = 'https://api.nextendweb.com/v2/nextend-api/v2/';
453
 
454
  public static function getEndpoint($action = '') {
455
  return self::$endpoint . 'product/nsl/' . urlencode($action);
564
  </div>';
565
  }
566
 
567
+ public static function show_theme_my_login_notice() {
568
+ echo '<div class="notice notice-info">
569
+ <p>' . sprintf(__('%1$s detected that %2$s installed on your site. You must set "<b>Page for register flow</b>" and "<b>OAuth redirect uri proxy page</b>" in %1$s to work properly.', 'nextend-facebook-connect'), '<b>Nextend Social Login</b>', '<b>Theme My Login</b>') . '</p>
570
+ <p><a href="' . NextendSocialLoginAdmin::getAdminSettingsUrl('general') . '" class="button button-primary">' . __('Fix now', 'nextend-facebook-connect') . '</a></p>
571
+ </div>';
572
+ }
573
+
574
  public static function isPro() {
575
  return apply_filters('nsl-pro', false);
576
  }
admin/templates-provider/sync-data.php CHANGED
@@ -75,9 +75,12 @@ NextendSocialLoginAdmin::showProBox();
75
  <input name="sync_fields[fields][<?php echo $fieldName; ?>][meta_key]" type="text" id="sync_fields_<?php echo $fieldName; ?>_meta_key"
76
  value="<?php echo esc_attr($settings->get('sync_fields/fields/' . $fieldName . '/meta_key')); ?>" class="regular-text" <?php echo $attr; ?>/>
77
  </fieldset>
78
- <?php if (isset($fieldData['scope'])): ?>
 
 
 
79
  <p class="description">
80
- <?php printf(__('Required scope: %1$s', 'nextend-facebook-connect'), $fieldData['scope']); ?>
81
  </p>
82
  <?php endif; ?>
83
  </td>
75
  <input name="sync_fields[fields][<?php echo $fieldName; ?>][meta_key]" type="text" id="sync_fields_<?php echo $fieldName; ?>_meta_key"
76
  value="<?php echo esc_attr($settings->get('sync_fields/fields/' . $fieldName . '/meta_key')); ?>" class="regular-text" <?php echo $attr; ?>/>
77
  </fieldset>
78
+ <?php
79
+ $description = $provider->getSyncDataFieldDescription($fieldName);
80
+ ?>
81
+ <?php if (!empty($description)): ?>
82
  <p class="description">
83
+ <?php echo $description; ?>
84
  </p>
85
  <?php endif; ?>
86
  </td>
admin/templates/debug.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="nsl-admin-content">
2
+ <style>
3
+ .nsl-admin-notices {
4
+ display: none;
5
+ }
6
+ </style>
7
+ <h1 class="title"><?php _e('Debug', 'nextend-facebook-connect'); ?></h1>
8
+ <?php
9
+
10
+
11
+ if (NextendSocialLoginAdmin::isPro()) {
12
+ $proAddonState = NextendSocialLoginAdmin::getProState();
13
+ echo "<p><b>Pro Addon State</b> : " . $proAddonState . "</p>";
14
+
15
+ $authorizedDomain = NextendSocialLogin::$settings->get('authorized_domain');
16
+ echo "<p><b>Authorized Domain</b> : " . $authorizedDomain . "</p>";
17
+
18
+ $currentDomain = NextendSocialLogin::getDomain();
19
+ echo "<p><b>Current Domain</b> : " . $currentDomain . "</p><br>";
20
+
21
+ $licenseKey = substr(NextendSocialLogin::$settings->get('license_key'), 0, 8);
22
+ echo "<p><b>License Key</b> : " . $licenseKey . "...</p>";
23
+
24
+ $isLicenseKeyOk = NextendSocialLogin::$settings->get('license_key_ok');
25
+ echo "<p><b>License Key OK</b> : " . (boolval($isLicenseKeyOk) ? 'Yes' : 'No') . "</p><br>";
26
+ }
27
+
28
+ $defaultRedirect = NextendSocialLogin::$settings->get('default_redirect');
29
+ echo "<p><b>Default Redirect URL</b> : " . $defaultRedirect . "</p>";
30
+
31
+ $defaultRedirectReg = NextendSocialLogin::$settings->get('default_redirect_reg');
32
+ echo "<p><b>Default Reg Redirect URL</b> : " . $defaultRedirectReg . "</p><br>";
33
+
34
+ $fixRedirect = NextendSocialLogin::$settings->get('redirect');
35
+ echo "<p><b>Fix Redirect URL</b> : " . $fixRedirect . "</p>";
36
+
37
+ $fixRedirectReg = NextendSocialLogin::$settings->get('redirect_reg');
38
+ echo "<p><b>Fix Reg Redirect URL</b> : " . $fixRedirectReg . "</p><br>";
39
+
40
+ echo '<h1>' . __('Test network connection with providers', 'nextend-facebook-connect') . '</h1>';
41
+ foreach (NextendSocialLogin::$allowedProviders AS $provider) {
42
+ ?>
43
+ <p>
44
+ <a target="_blank" href="<?php echo add_query_arg('provider', $provider->getId(), NextendSocialLoginAdmin::getAdminUrl('test-connection')); ?>" class="button button-primary">
45
+ <?php printf(__('Test %1$s connection', 'nextend-facebook-connect'), $provider->getLabel()); ?>
46
+ </a>
47
+ </p>
48
+ <?php
49
+ }
50
+ ?>
51
+ </div>
admin/templates/header.php CHANGED
@@ -16,6 +16,9 @@ defined('ABSPATH') || die();
16
  <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/', 'header-menu-support'); ?>"
17
  class="nsl-admin-header-nav" target="_blank"><?php _e('Support', 'nextend-facebook-connect'); ?></a>
18
 
 
 
 
19
  <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/social-login/', 'header-menu-pro-addon'); ?>"
20
  class="nsl-admin-header-nav" target="_blank"><?php _e('Pro Addon', 'nextend-facebook-connect'); ?></a>
21
  </div>
16
  <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/', 'header-menu-support'); ?>"
17
  class="nsl-admin-header-nav" target="_blank"><?php _e('Support', 'nextend-facebook-connect'); ?></a>
18
 
19
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl('debug'); ?>"
20
+ class="nsl-admin-header-nav"><?php _e('Debug', 'nextend-facebook-connect'); ?></a>
21
+
22
  <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/social-login/', 'header-menu-pro-addon'); ?>"
23
  class="nsl-admin-header-nav" target="_blank"><?php _e('Pro Addon', 'nextend-facebook-connect'); ?></a>
24
  </div>
admin/templates/settings/general.php CHANGED
@@ -80,6 +80,19 @@
80
  </td>
81
  </tr>
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  <tr>
84
  <th scope="row"><label
85
  for="default_redirect"><?php _e('Default redirect url', 'nextend-facebook-connect'); ?></label>
80
  </td>
81
  </tr>
82
 
83
+ <tr>
84
+ <th scope="row"><label
85
+ for="default_redirect"><?php _e('Prevent external redirect overrides', 'nextend-facebook-connect'); ?></label>
86
+ </th>
87
+ <td>
88
+ <label for="redirect_prevent_external">
89
+ <input type="hidden" name="redirect_prevent_external" value="0">
90
+ <input type="checkbox" name="redirect_prevent_external" id="redirect_prevent_external" value="1"<?php if ($settings->get('redirect_prevent_external') == '1') : ?> checked="checked" <?php endif; ?>>
91
+ <?php _e('Disable external redirects', 'nextend-facebook-connect'); ?>
92
+ </label>
93
+ </td>
94
+ </tr>
95
+
96
  <tr>
97
  <th scope="row"><label
98
  for="default_redirect"><?php _e('Default redirect url', 'nextend-facebook-connect'); ?></label>
admin/templates/show-debug.php DELETED
@@ -1,40 +0,0 @@
1
- <div class="nsl-admin-content">
2
- <style>
3
- .nsl-admin-notices {
4
- display: none;
5
- }
6
- </style>
7
- <h1 class="title"><?php _e('Debug', 'nextend-facebook-connect'); ?></h1>
8
- <?php
9
-
10
- $proAddonState = NextendSocialLoginAdmin::getProState();
11
- $authorizedDomain = NextendSocialLogin::$settings->get('authorized_domain');
12
- $currentDomain = NextendSocialLogin::getDomain();
13
-
14
- $licenseKey = substr(NextendSocialLogin::$settings->get('license_key'),0,8);
15
- $isLicenseKeyOk = NextendSocialLogin::$settings->get('license_key_ok');
16
-
17
- $defaultRedirect = NextendSocialLogin::$settings->get('default_redirect');
18
- $defaultRedirectReg = NextendSocialLogin::$settings->get('default_redirect_reg');
19
-
20
- $fixRedirect = NextendSocialLogin::$settings->get('redirect');
21
- $fixRedirectReg = NextendSocialLogin::$settings->get('redirect_reg');
22
-
23
- echo "<p><b>Pro Addon State</b> : ".$proAddonState."</p>";
24
- echo "<p><b>Authorized Domain</b> : ".$authorizedDomain."</p>";
25
- echo "<p><b>Current Domain</b> : ".$currentDomain."</p><br>";
26
-
27
- echo "<p><b>License Key</b> : ".$licenseKey."...</p>";
28
- echo "<p><b>License Key OK</b> : ". (boolval($isLicenseKeyOk) ? 'true' : 'false') ."</p><br>";
29
-
30
- echo "<p><b>Default Redirect URL</b> : ".$defaultRedirect."</p>";
31
- echo "<p><b>Default Reg Redirect URL</b> : ".$defaultRedirectReg."</p><br>";
32
-
33
- echo "<p><b>Fix Redirect URL</b> : ".$fixRedirect."</p>";
34
- echo "<p><b>Fix Reg Redirect URL</b> : ".$fixRedirectReg."</p><br>";
35
-
36
-
37
-
38
-
39
- ?>
40
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/templates/test-connection.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (isset($_GET['provider'])) {
4
+ $providerID = $_GET['provider'];
5
+
6
+ if (isset(NextendSocialLogin::$allowedProviders[$providerID])) {
7
+ $provider = NextendSocialLogin::$allowedProviders[$providerID];
8
+ ?>
9
+ <div class="nsl-admin-content">
10
+ <h1>Debug: <?php echo $provider->getLabel(); ?></h1>
11
+
12
+ <?php
13
+
14
+ $ch = curl_init();
15
+ curl_setopt($ch, CURLOPT_URL, $provider->getTestUrl());
16
+ curl_setopt($ch, CURLOPT_POST, 1);
17
+ curl_setopt($ch, CURLOPT_POSTFIELDS, "");
18
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
19
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
20
+
21
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
22
+ curl_setopt($ch, CURLOPT_TIMEOUT, 5);
23
+
24
+ $file = tempnam(sys_get_temp_dir(), 'nsl-test');
25
+ $temporaryHandle = fopen($file, 'w+');
26
+ curl_setopt($ch, CURLOPT_STDERR, $temporaryHandle);
27
+
28
+ $output = curl_exec($ch);
29
+ curl_close($ch);
30
+
31
+ rewind($temporaryHandle);
32
+
33
+ $verboseLog = stream_get_contents($temporaryHandle);
34
+ if (preg_match('/connected/i', $verboseLog)) {
35
+ ?>
36
+ <div class="updated"><p><b><?php printf(__('Network connection successful: %1$s', 'nextend-facebook-connect'), $provider->getTestUrl()); ?></b></p></div>
37
+ <?php
38
+ } else {
39
+ ?>
40
+ <div class="error">
41
+ <p>
42
+ <b><?php printf(__('Network connection failed: %1$s', 'nextend-facebook-connect'), $provider->getTestUrl()); ?></b>
43
+ </p>
44
+ <p>
45
+ <?php _e('Please contact with your hosting provider to resolve the network issue between your server and the provider.', 'nextend-facebook-connect'); ?>
46
+ </p>
47
+ </div>
48
+ <?php
49
+ }
50
+
51
+ echo "<pre>", htmlspecialchars($verboseLog), "</pre>\n";
52
+ fclose($temporaryHandle);
53
+
54
+ echo "<pre>", htmlspecialchars($output), "</pre>\n";
55
+ @unlink($file);
56
+ ?>
57
+ </div>
58
+ <?php
59
+ }
60
+ }
includes/auth.php CHANGED
@@ -25,10 +25,15 @@ abstract class NextendSocialAuth {
25
 
26
  public abstract function authenticate();
27
 
28
- public abstract function get($path, $data = array());
29
 
30
  /**
31
  * @return bool
32
  */
33
  public abstract function hasAuthenticateData();
 
 
 
 
 
34
  }
25
 
26
  public abstract function authenticate();
27
 
28
+ public abstract function get($path, $data = array(), $endpoint = false);
29
 
30
  /**
31
  * @return bool
32
  */
33
  public abstract function hasAuthenticateData();
34
+
35
+ /**
36
+ * @return string
37
+ */
38
+ public abstract function getTestUrl();
39
  }
includes/oauth2.php CHANGED
@@ -29,6 +29,10 @@ abstract class NextendSocialOauth2 extends NextendSocialAuth {
29
  }
30
  }
31
 
 
 
 
 
32
  public function hasAuthenticateData() {
33
  return isset($_REQUEST['code']);
34
  }
@@ -115,7 +119,7 @@ abstract class NextendSocialOauth2 extends NextendSocialAuth {
115
  )
116
  );
117
 
118
- $request = wp_remote_post($this->endpointAccessToken, $http_args);
119
 
120
  if (is_wp_error($request)) {
121
 
@@ -245,19 +249,22 @@ abstract class NextendSocialOauth2 extends NextendSocialAuth {
245
  /**
246
  * @param $path
247
  * @param array $data
 
248
  *
249
- * @return mixed
250
  * @throws Exception
251
  */
252
- public function get($path, $data = array()) {
253
 
254
  $http_args = array(
255
  'timeout' => 15,
256
  'user-agent' => 'WordPress',
257
  'body' => array_merge($this->defaultRestParams, $data)
258
  );
259
-
260
- $request = wp_remote_get($this->endpointRestAPI . $path, $this->extendHttpArgs($http_args));
 
 
261
 
262
  if (is_wp_error($request)) {
263
 
@@ -290,4 +297,9 @@ abstract class NextendSocialOauth2 extends NextendSocialAuth {
290
 
291
  return $http_args;
292
  }
 
 
 
 
 
293
  }
29
  }
30
  }
31
 
32
+ public function getTestUrl() {
33
+ return $this->endpointAccessToken;
34
+ }
35
+
36
  public function hasAuthenticateData() {
37
  return isset($_REQUEST['code']);
38
  }
119
  )
120
  );
121
 
122
+ $request = wp_remote_post($this->endpointAccessToken, $this->extendAllHttpArgs($http_args));
123
 
124
  if (is_wp_error($request)) {
125
 
249
  /**
250
  * @param $path
251
  * @param array $data
252
+ * @param $endpoint
253
  *
254
+ * @return array
255
  * @throws Exception
256
  */
257
+ public function get($path, $data = array(), $endpoint = false) {
258
 
259
  $http_args = array(
260
  'timeout' => 15,
261
  'user-agent' => 'WordPress',
262
  'body' => array_merge($this->defaultRestParams, $data)
263
  );
264
+ if (!$endpoint) {
265
+ $endpoint = $this->endpointRestAPI;
266
+ }
267
+ $request = wp_remote_get($endpoint . $path, $this->extendHttpArgs($this->extendAllHttpArgs($http_args)));
268
 
269
  if (is_wp_error($request)) {
270
 
297
 
298
  return $http_args;
299
  }
300
+
301
+ protected function extendAllHttpArgs($http_args) {
302
+
303
+ return $http_args;
304
+ }
305
  }
includes/provider.php CHANGED
@@ -227,6 +227,10 @@ abstract class NextendSocialProvider extends NextendSocialProviderDummy {
227
  */
228
  protected abstract function getClient();
229
 
 
 
 
 
230
  /**
231
  * @throws NSLContinuePageRenderException
232
  */
@@ -638,6 +642,25 @@ abstract class NextendSocialProvider extends NextendSocialProviderDummy {
638
  return wp_validate_redirect($location, apply_filters('wp_safe_redirect_fallback', admin_url(), 302));
639
  }
640
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
641
  /**
642
  * If fixed redirect url is set, redirect to fixed redirect url.
643
  * If fixed redirect url is not set, but redirect is in the url redirect to the $_GET['redirect'].
@@ -705,8 +728,9 @@ abstract class NextendSocialProvider extends NextendSocialProviderDummy {
705
  $redirect_to = $defaultRedirect;
706
  }
707
  }
708
- }
709
 
 
 
710
 
711
  if ($redirect_to == '' || $redirect_to == $this->getLoginUrl()) {
712
  $redirect_to = site_url();
@@ -977,4 +1001,8 @@ abstract class NextendSocialProvider extends NextendSocialProviderDummy {
977
  $this->saveUserData($userID, 'access_token', $accessToken);
978
  }
979
  }
 
 
 
 
980
  }
227
  */
228
  protected abstract function getClient();
229
 
230
+ public function getTestUrl(){
231
+ return $this->getClient()->getTestUrl();
232
+ }
233
+
234
  /**
235
  * @throws NSLContinuePageRenderException
236
  */
642
  return wp_validate_redirect($location, apply_filters('wp_safe_redirect_fallback', admin_url(), 302));
643
  }
644
 
645
+ public function hasFixedRedirect() {
646
+ if (NextendSocialLogin::$WPLoginCurrentFlow == 'register') {
647
+ $fixedRedirect = NextendSocialLogin::$settings->get('redirect_reg');
648
+ $fixedRedirect = apply_filters($this->id . '_register_redirect_url', $fixedRedirect, $this);
649
+ if (!empty($fixedRedirect)) {
650
+ return true;
651
+ }
652
+
653
+ } else if (NextendSocialLogin::$WPLoginCurrentFlow == 'login') {
654
+ $fixedRedirect = NextendSocialLogin::$settings->get('redirect');
655
+ $fixedRedirect = apply_filters($this->id . '_login_redirect_url', $fixedRedirect, $this);
656
+ if (!empty($fixedRedirect)) {
657
+ return true;
658
+ }
659
+ }
660
+
661
+ return false;
662
+ }
663
+
664
  /**
665
  * If fixed redirect url is set, redirect to fixed redirect url.
666
  * If fixed redirect url is not set, but redirect is in the url redirect to the $_GET['redirect'].
728
  $redirect_to = $defaultRedirect;
729
  }
730
  }
 
731
 
732
+ $redirect_to = apply_filters('nsl_' . $this->getId() . 'default_last_location_redirect', $redirect_to, $requested_redirect_to);
733
+ }
734
 
735
  if ($redirect_to == '' || $redirect_to == $this->getLoginUrl()) {
736
  $redirect_to = site_url();
1001
  $this->saveUserData($userID, 'access_token', $accessToken);
1002
  }
1003
  }
1004
+
1005
+ public function getSyncDataFieldDescription($fieldName) {
1006
+ return '';
1007
+ }
1008
  }
includes/user.php CHANGED
@@ -10,6 +10,8 @@ class NextendSocialUser {
10
 
11
  private $userExtraData;
12
 
 
 
13
  /**
14
  * NextendSocialUser constructor.
15
  *
@@ -347,6 +349,8 @@ class NextendSocialUser {
347
 
348
  protected function login($user_id) {
349
 
 
 
350
  add_action('nsl_' . $this->provider->getId() . '_login', array(
351
  $this->provider,
352
  'syncProfile'
@@ -365,30 +369,63 @@ class NextendSocialUser {
365
  $auth_secure_cookie = $secure_cookie;
366
  wp_set_auth_cookie($user_id, true, $secure_cookie);
367
  $user_info = get_userdata($user_id);
368
- do_action('wp_login', $user_info->user_login, $user_info);
369
 
370
- do_action('nsl_login', $user_id, $this->provider);
371
- do_action('nsl_' . $this->provider->getId() . '_login', $user_id, $this->provider, $this->access_token);
 
 
 
 
 
 
 
 
 
 
372
 
373
- $this->redirectToLastLocationLogin();
 
 
 
 
 
 
 
 
374
 
 
375
  }
376
 
377
  $this->provider->redirectToLoginForm();
378
  }
379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  /**
381
  * Redirect the user to
382
  * -the Fixed redirect url if it is set
383
- * -where the login has happend if redirect is specified in the url
384
  * -the Default redirect url if it is set, and if redirect was not specified in the url
385
  */
386
  public function redirectToLastLocationLogin() {
387
 
388
- add_filter('nsl_' . $this->provider->getId() . 'last_location_redirect', array(
389
- $this,
390
- 'loginLastLocationRedirect'
391
- ), 9, 2);
 
 
392
 
393
  $this->provider->redirectToLastLocation();
394
  }
10
 
11
  private $userExtraData;
12
 
13
+ protected $user_id;
14
+
15
  /**
16
  * NextendSocialUser constructor.
17
  *
349
 
350
  protected function login($user_id) {
351
 
352
+ $this->user_id = $user_id;
353
+
354
  add_action('nsl_' . $this->provider->getId() . '_login', array(
355
  $this->provider,
356
  'syncProfile'
369
  $auth_secure_cookie = $secure_cookie;
370
  wp_set_auth_cookie($user_id, true, $secure_cookie);
371
  $user_info = get_userdata($user_id);
 
372
 
373
+ $addStrongerRedirect = NextendSocialLogin::$settings->get('redirect_prevent_external') == 1 || $this->provider->hasFixedRedirect();
374
+ if ($addStrongerRedirect) {
375
+ /**
376
+ * If another plugin tries to redirect in wp_login action, we will intercept and use our redirects
377
+ */
378
+ add_filter('wp_redirect', array(
379
+ $this,
380
+ 'wp_redirect_filter'
381
+ ), 10000000);
382
+ }
383
+
384
+ do_action('wp_login', $user_info->user_login, $user_info);
385
 
386
+ if ($addStrongerRedirect) {
387
+ /**
388
+ * Remove redirect interception when not needed anymore
389
+ */
390
+ remove_filter('wp_redirect', array(
391
+ $this,
392
+ 'wp_redirect_filter'
393
+ ), 10000000);
394
+ }
395
 
396
+ $this->finishLogin();
397
  }
398
 
399
  $this->provider->redirectToLoginForm();
400
  }
401
 
402
+ public function wp_redirect_filter($redirect) {
403
+ $this->finishLogin();
404
+ exit;
405
+ }
406
+
407
+ protected function finishLogin() {
408
+
409
+ do_action('nsl_login', $this->user_id, $this->provider);
410
+ do_action('nsl_' . $this->provider->getId() . '_login', $this->user_id, $this->provider, $this->access_token);
411
+
412
+ $this->redirectToLastLocationLogin();
413
+ }
414
+
415
  /**
416
  * Redirect the user to
417
  * -the Fixed redirect url if it is set
418
+ * -where the login happened if redirect is specified in the url
419
  * -the Default redirect url if it is set, and if redirect was not specified in the url
420
  */
421
  public function redirectToLastLocationLogin() {
422
 
423
+ if (NextendSocialLogin::$settings->get('redirect_prevent_external') == 0) {
424
+ add_filter('nsl_' . $this->provider->getId() . 'default_last_location_redirect', array(
425
+ $this,
426
+ 'loginLastLocationRedirect'
427
+ ), 9, 2);
428
+ }
429
 
430
  $this->provider->redirectToLastLocation();
431
  }
nextend-facebook-connect.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Nextend Social Login
4
  Plugin URI: https://nextendweb.com/
5
  Description: Nextend Social Login displays social login buttons for Facebook, Google and Twitter.
6
- Version: 3.0.10
7
  Author: Nextendweb
8
  License: GPL2
9
  Text Domain: nextend-facebook-connect
3
  Plugin Name: Nextend Social Login
4
  Plugin URI: https://nextendweb.com/
5
  Description: Nextend Social Login displays social login buttons for Facebook, Google and Twitter.
6
+ Version: 3.0.11
7
  Author: Nextendweb
8
  License: GPL2
9
  Text Domain: nextend-facebook-connect
nextend-social-login.php CHANGED
@@ -16,9 +16,9 @@ require_once(NSL_PATH . '/compat.php');
16
 
17
  class NextendSocialLogin {
18
 
19
- public static $version = '3.0.10';
20
 
21
- public static $nslPROMinVersion = '3.0.8';
22
 
23
  public static $proxyPage = false;
24
 
@@ -157,6 +157,7 @@ class NextendSocialLogin {
157
  'store_email' => 1,
158
  'avatar_store' => 1,
159
  'store_access_token' => 1,
 
160
  'redirect' => '',
161
  'redirect_reg' => '',
162
  'default_redirect' => '',
16
 
17
  class NextendSocialLogin {
18
 
19
+ public static $version = '3.0.11';
20
 
21
+ public static $nslPROMinVersion = '3.0.11';
22
 
23
  public static $proxyPage = false;
24
 
157
  'store_email' => 1,
158
  'avatar_store' => 1,
159
  'store_access_token' => 1,
160
+ 'redirect_prevent_external' => 0,
161
  'redirect' => '',
162
  'redirect_reg' => '',
163
  'default_redirect' => '',
providers/facebook/facebook-client.php CHANGED
@@ -54,7 +54,7 @@ class NextendSocialProviderFacebookClient extends NextendSocialOauth2 {
54
  )
55
  );
56
 
57
- $request = wp_remote_get($this->endpointAccessToken, $http_args);
58
 
59
  if (is_wp_error($request)) {
60
 
@@ -83,4 +83,18 @@ class NextendSocialProviderFacebookClient extends NextendSocialOauth2 {
83
  }
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
54
  )
55
  );
56
 
57
+ $request = wp_remote_get($this->endpointAccessToken, $this->extendAllHttpArgs($http_args));
58
 
59
  if (is_wp_error($request)) {
60
 
83
  }
84
  }
85
 
86
+ protected function extendAllHttpArgs($http_args) {
87
+ $http_args['body']['appsecret_proof'] = hash_hmac('sha256', $this->getAccessToken(), $this->client_secret);
88
+
89
+ return $http_args;
90
+ }
91
+
92
+ protected function getAccessToken() {
93
+ if (!empty($this->access_token_data['access_token'])) {
94
+ return $this->access_token_data['access_token'];
95
+ }
96
+
97
+ return $this->client_id;
98
+ }
99
+
100
  }
providers/facebook/facebook.php CHANGED
@@ -105,6 +105,9 @@ class NextendSocialProviderFacebook extends NextendSocialProvider {
105
  return $settings;
106
  }
107
 
 
 
 
108
  public function getClient() {
109
  if ($this->client === null) {
110
 
@@ -174,7 +177,8 @@ class NextendSocialProviderFacebook extends NextendSocialProvider {
174
  }
175
 
176
  /**
177
- * @return array
 
178
  */
179
  protected function getCurrentUserInfo() {
180
 
@@ -186,7 +190,7 @@ class NextendSocialProviderFacebook extends NextendSocialProvider {
186
  'last_name',
187
  'picture.type(large)'
188
  );
189
- $extra_fields = apply_filters('nsl_facebook_me_fields', array());
190
 
191
  return $this->getClient()
192
  ->get('/me?fields=' . implode(',', array_merge($fields, $extra_fields)));
@@ -323,6 +327,14 @@ class NextendSocialProviderFacebook extends NextendSocialProvider {
323
  $this->client->deleteLoginPersistentData();
324
  }
325
  }
 
 
 
 
 
 
 
 
326
  }
327
 
328
  NextendSocialLogin::addProvider(new NextendSocialProviderFacebook);
105
  return $settings;
106
  }
107
 
108
+ /**
109
+ * @return NextendSocialProviderFacebookClient
110
+ */
111
  public function getClient() {
112
  if ($this->client === null) {
113
 
177
  }
178
 
179
  /**
180
+ * @return array|mixed
181
+ * @throws Exception
182
  */
183
  protected function getCurrentUserInfo() {
184
 
190
  'last_name',
191
  'picture.type(large)'
192
  );
193
+ $extra_fields = apply_filters('nsl_facebook_sync_node_fields', array(), 'me');
194
 
195
  return $this->getClient()
196
  ->get('/me?fields=' . implode(',', array_merge($fields, $extra_fields)));
327
  $this->client->deleteLoginPersistentData();
328
  }
329
  }
330
+
331
+ public function getSyncDataFieldDescription($fieldName) {
332
+ if (isset($this->sync_fields[$fieldName]['scope'])) {
333
+ return sprintf(__('Required scope: %1$s', 'nextend-facebook-connect'), $this->sync_fields[$fieldName]['scope']);
334
+ }
335
+
336
+ return parent::getSyncDataFieldDescription($fieldName);
337
+ }
338
  }
339
 
340
  NextendSocialLogin::addProvider(new NextendSocialProviderFacebook);
providers/google/google-client.php CHANGED
@@ -13,8 +13,8 @@ class NextendSocialProviderGoogleClient extends NextendSocialOauth2 {
13
  private $approvalPrompt = 'force';
14
 
15
  protected $scopes = array(
16
- 'https://www.googleapis.com/auth/userinfo.profile',
17
- 'https://www.googleapis.com/auth/userinfo.email'
18
  );
19
 
20
  protected $endpointAuthorization = 'https://accounts.google.com/o/oauth2/auth';
13
  private $approvalPrompt = 'force';
14
 
15
  protected $scopes = array(
16
+ 'https://www.googleapis.com/auth/userinfo.email',
17
+ 'https://www.googleapis.com/auth/userinfo.profile'
18
  );
19
 
20
  protected $endpointAuthorization = 'https://accounts.google.com/o/oauth2/auth';
providers/google/google.php CHANGED
@@ -9,6 +9,54 @@ class NextendSocialProviderGoogle extends NextendSocialProvider {
9
 
10
  protected $svg = '<svg xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M7.636 11.545v2.619h4.331c-.174 1.123-1.309 3.294-4.33 3.294-2.608 0-4.735-2.16-4.735-4.822 0-2.661 2.127-4.821 4.734-4.821 1.484 0 2.477.632 3.044 1.178l2.073-1.997C11.422 5.753 9.698 5 7.636 5A7.63 7.63 0 0 0 0 12.636a7.63 7.63 0 0 0 7.636 7.637c4.408 0 7.331-3.098 7.331-7.462 0-.502-.054-.884-.12-1.266h-7.21zm16.364 0h-2.182V9.364h-2.182v2.181h-2.181v2.182h2.181v2.182h2.182v-2.182H24"/></svg>';
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  public function __construct() {
13
  $this->id = 'google';
14
  $this->label = 'Google';
@@ -98,8 +146,33 @@ class NextendSocialProviderGoogle extends NextendSocialProvider {
98
  * @throws Exception
99
  */
100
  protected function getCurrentUserInfo() {
 
 
 
 
 
 
 
 
 
 
101
  return $this->getClient()
102
- ->get('userinfo');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
  /**
@@ -221,6 +294,14 @@ class NextendSocialProviderGoogle extends NextendSocialProvider {
221
 
222
  return $picture;
223
  }
 
 
 
 
 
 
 
 
224
  }
225
 
226
  NextendSocialLogin::addProvider(new NextendSocialProviderGoogle);
9
 
10
  protected $svg = '<svg xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M7.636 11.545v2.619h4.331c-.174 1.123-1.309 3.294-4.33 3.294-2.608 0-4.735-2.16-4.735-4.822 0-2.661 2.127-4.821 4.734-4.821 1.484 0 2.477.632 3.044 1.178l2.073-1.997C11.422 5.753 9.698 5 7.636 5A7.63 7.63 0 0 0 0 12.636a7.63 7.63 0 0 0 7.636 7.637c4.408 0 7.331-3.098 7.331-7.462 0-.502-.054-.884-.12-1.266h-7.21zm16.364 0h-2.182V9.364h-2.182v2.181h-2.181v2.182h2.181v2.182h2.182v-2.182H24"/></svg>';
11
 
12
+ const requiredApi1 = 'Google+ API';
13
+
14
+ protected $sync_fields = array(
15
+ 'gender' => array(
16
+ 'label' => 'Gender',
17
+ 'node' => 'me',
18
+ ),
19
+ 'link' => array(
20
+ 'label' => 'Profile link',
21
+ 'node' => 'me',
22
+ ),
23
+ 'locale' => array(
24
+ 'label' => 'Locale',
25
+ 'node' => 'me',
26
+ ),
27
+ 'aboutMe' => array(
28
+ 'label' => 'Introduction',
29
+ 'node' => 'gplus',
30
+ 'description' => self::requiredApi1,
31
+
32
+ ),
33
+ 'birthday' => array(
34
+ 'label' => 'Birthday',
35
+ 'node' => 'gplus',
36
+ 'description' => self::requiredApi1
37
+ ),
38
+ 'occupation' => array(
39
+ 'label' => 'Occupation',
40
+ 'node' => 'gplus',
41
+ 'description' => self::requiredApi1
42
+ ),
43
+ 'organizations' => array(
44
+ 'label' => 'Organizations',
45
+ 'node' => 'gplus',
46
+ 'description' => self::requiredApi1
47
+ ),
48
+ 'placesLived' => array(
49
+ 'label' => 'Places lived',
50
+ 'node' => 'gplus',
51
+ 'description' => self::requiredApi1
52
+ ),
53
+ 'tagline' => array(
54
+ 'label' => 'Tag line',
55
+ 'node' => 'gplus',
56
+ 'description' => self::requiredApi1
57
+ )
58
+ );
59
+
60
  public function __construct() {
61
  $this->id = 'google';
62
  $this->label = 'Google';
146
  * @throws Exception
147
  */
148
  protected function getCurrentUserInfo() {
149
+ $fields = array(
150
+ 'id',
151
+ 'name',
152
+ 'email',
153
+ 'family_name',
154
+ 'given_name',
155
+ 'picture',
156
+ );
157
+ $extra_me_fields = apply_filters('nsl_google_sync_node_fields', array(), 'me');
158
+
159
  return $this->getClient()
160
+ ->get('userinfo?fields=' . implode(',', array_merge($fields, $extra_me_fields)));
161
+ }
162
+
163
+ public function getMe() {
164
+ return $this->authUserData;
165
+ }
166
+
167
+ /**
168
+ * @return array
169
+ * @throws Exception
170
+ */
171
+ public function getMyGooglePlus() {
172
+ $extra_gplus_fields = apply_filters('nsl_google_sync_node_fields', array(), 'gplus');
173
+
174
+ return $this->getClient()
175
+ ->get('people/me?fields=' . implode(',', $extra_gplus_fields), array(), 'https://www.googleapis.com/plus/v1/');
176
  }
177
 
178
  /**
294
 
295
  return $picture;
296
  }
297
+
298
+ public function getSyncDataFieldDescription($fieldName) {
299
+ if (isset($this->sync_fields[$fieldName]['description'])) {
300
+ return sprintf(__('Required API: %1$s', 'nextend-facebook-connect'), $this->sync_fields[$fieldName]['description']);
301
+ }
302
+
303
+ return parent::getSyncDataFieldDescription($fieldName);
304
+ }
305
  }
306
 
307
  NextendSocialLogin::addProvider(new NextendSocialProviderGoogle);
providers/twitter/twitter-client.php CHANGED
@@ -22,6 +22,10 @@ class NextendSocialProviderTwitterClient extends NextendSocialAuth {
22
  $this->consumer_secret = $consumer_secret;
23
  }
24
 
 
 
 
 
25
  /**
26
  * @param string $redirect_uri
27
  */
@@ -100,9 +104,13 @@ class NextendSocialProviderTwitterClient extends NextendSocialAuth {
100
  * @return array|mixed|object
101
  * @throws Exception
102
  */
103
- public function get($path, $data = array()) {
 
 
 
 
104
 
105
- $response = $this->oauthRequest($this->endpoint . '1.1/' . $path . '.json', 'GET', $data + array(
106
  'user_id' => $this->access_token_data['user_id']
107
  ), array(), array(
108
  'token' => $this->access_token_data['oauth_token'],
@@ -294,7 +302,7 @@ class NextendSocialProviderTwitterClient extends NextendSocialAuth {
294
  private function token($context) {
295
  if (isset($context['token']) && !empty($context['token'])) {
296
  return $context['token'];
297
- } elseif (isset($context['user_token'])) {
298
  return $context['user_token'];
299
  }
300
 
@@ -305,7 +313,7 @@ class NextendSocialProviderTwitterClient extends NextendSocialAuth {
305
 
306
  if (isset($context['secret']) && !empty($context['secret'])) {
307
  return $context['secret'];
308
- } elseif (isset($context['user_secret'])) {
309
  return $context['user_secret'];
310
  }
311
 
22
  $this->consumer_secret = $consumer_secret;
23
  }
24
 
25
+ public function getTestUrl() {
26
+ return $this->endpoint;
27
+ }
28
+
29
  /**
30
  * @param string $redirect_uri
31
  */
104
  * @return array|mixed|object
105
  * @throws Exception
106
  */
107
+ public function get($path, $data = array(), $endpoint = false) {
108
+
109
+ if (!$endpoint) {
110
+ $endpoint = $this->endpoint;
111
+ }
112
 
113
+ $response = $this->oauthRequest($endpoint . '1.1/' . $path . '.json', 'GET', $data + array(
114
  'user_id' => $this->access_token_data['user_id']
115
  ), array(), array(
116
  'token' => $this->access_token_data['oauth_token'],
302
  private function token($context) {
303
  if (isset($context['token']) && !empty($context['token'])) {
304
  return $context['token'];
305
+ } else if (isset($context['user_token'])) {
306
  return $context['user_token'];
307
  }
308
 
313
 
314
  if (isset($context['secret']) && !empty($context['secret'])) {
315
  return $context['secret'];
316
+ } else if (isset($context['user_secret'])) {
317
  return $context['user_secret'];
318
  }
319
 
providers/twitter/twitter.php CHANGED
@@ -9,6 +9,39 @@ class NextendSocialProviderTwitter extends NextendSocialProvider {
9
 
10
  protected $svg = '<svg xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M16.327 3.007A5.07 5.07 0 0 1 20.22 4.53a8.207 8.207 0 0 0 2.52-.84l.612-.324a4.78 4.78 0 0 1-1.597 2.268 2.356 2.356 0 0 1-.54.384v.012A9.545 9.545 0 0 0 24 5.287v.012a7.766 7.766 0 0 1-1.67 1.884l-.768.612a13.896 13.896 0 0 1-9.874 13.848c-2.269.635-4.655.73-6.967.276a16.56 16.56 0 0 1-2.895-.936 10.25 10.25 0 0 1-1.394-.708L0 20.023a8.44 8.44 0 0 0 1.573.06c.48-.084.96-.06 1.405-.156a10.127 10.127 0 0 0 2.956-1.056 5.41 5.41 0 0 0 1.333-.852 4.44 4.44 0 0 1-1.465-.264 4.9 4.9 0 0 1-3.12-3.108c.73.134 1.482.1 2.198-.096a3.457 3.457 0 0 1-1.609-.636A4.651 4.651 0 0 1 .953 9.763c.168.072.336.156.504.24.334.127.68.22 1.033.276.216.074.447.095.673.06H3.14c-.248-.288-.653-.468-.901-.78a4.91 4.91 0 0 1-1.105-4.404 5.62 5.62 0 0 1 .528-1.26c.008 0 .017.012.024.012.13.182.28.351.445.504a8.88 8.88 0 0 0 1.465 1.38 14.43 14.43 0 0 0 6.018 2.868 9.065 9.065 0 0 0 2.21.288 4.448 4.448 0 0 1 .025-2.28 4.771 4.771 0 0 1 2.786-3.252 5.9 5.9 0 0 1 1.093-.336l.6-.072z"/></svg>';
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  public function __construct() {
13
  $this->id = 'twitter';
14
  $this->label = 'Twitter';
@@ -98,13 +131,23 @@ class NextendSocialProviderTwitter extends NextendSocialProvider {
98
  * @throws Exception
99
  */
100
  protected function getCurrentUserInfo() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
- return $this->getClient()
103
- ->get('account/verify_credentials', array(
104
- 'include_email' => 'true',
105
- 'include_entities' => 'false',
106
- 'skip_status' => 'true'
107
- ));
108
  }
109
 
110
  /**
9
 
10
  protected $svg = '<svg xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M16.327 3.007A5.07 5.07 0 0 1 20.22 4.53a8.207 8.207 0 0 0 2.52-.84l.612-.324a4.78 4.78 0 0 1-1.597 2.268 2.356 2.356 0 0 1-.54.384v.012A9.545 9.545 0 0 0 24 5.287v.012a7.766 7.766 0 0 1-1.67 1.884l-.768.612a13.896 13.896 0 0 1-9.874 13.848c-2.269.635-4.655.73-6.967.276a16.56 16.56 0 0 1-2.895-.936 10.25 10.25 0 0 1-1.394-.708L0 20.023a8.44 8.44 0 0 0 1.573.06c.48-.084.96-.06 1.405-.156a10.127 10.127 0 0 0 2.956-1.056 5.41 5.41 0 0 0 1.333-.852 4.44 4.44 0 0 1-1.465-.264 4.9 4.9 0 0 1-3.12-3.108c.73.134 1.482.1 2.198-.096a3.457 3.457 0 0 1-1.609-.636A4.651 4.651 0 0 1 .953 9.763c.168.072.336.156.504.24.334.127.68.22 1.033.276.216.074.447.095.673.06H3.14c-.248-.288-.653-.468-.901-.78a4.91 4.91 0 0 1-1.105-4.404 5.62 5.62 0 0 1 .528-1.26c.008 0 .017.012.024.012.13.182.28.351.445.504a8.88 8.88 0 0 0 1.465 1.38 14.43 14.43 0 0 0 6.018 2.868 9.065 9.065 0 0 0 2.21.288 4.448 4.448 0 0 1 .025-2.28 4.771 4.771 0 0 1 2.786-3.252 5.9 5.9 0 0 1 1.093-.336l.6-.072z"/></svg>';
11
 
12
+ protected $sync_fields = array(
13
+
14
+ 'description' => array(
15
+ 'label' => 'Bio',
16
+ 'node' => 'me'
17
+ ),
18
+ 'lang' => array(
19
+ 'label' => 'Language',
20
+ 'node' => 'me'
21
+ ),
22
+ 'location' => array(
23
+ 'label' => 'Location',
24
+ 'node' => 'me'
25
+ ),
26
+ 'created_at' => array(
27
+ 'label' => 'Register date',
28
+ 'node' => 'me'
29
+ ),
30
+ 'profile_url' => array(
31
+ 'label' => 'Profile URL',
32
+ 'node' => 'me'
33
+ ),
34
+ 'screen_name' => array(
35
+ 'label' => 'Screen name',
36
+ 'node' => 'me'
37
+ ),
38
+ 'url' => array(
39
+ 'label' => 'Owned website',
40
+ 'node' => 'me'
41
+ )
42
+
43
+ );
44
+
45
  public function __construct() {
46
  $this->id = 'twitter';
47
  $this->label = 'Twitter';
131
  * @throws Exception
132
  */
133
  protected function getCurrentUserInfo() {
134
+ $response = $this->getClient()
135
+ ->get('account/verify_credentials', array(
136
+ 'include_email' => 'true',
137
+ 'include_entities' => 'false',
138
+ 'skip_status' => 'true'
139
+ ));
140
+
141
+ if (isset($response['id']) && isset($response['id_str'])) {
142
+ // On 32bit and Windows server, we must copy id_str to id as the id int representation won't be OK
143
+ $response['id'] = $response['id_str'];
144
+ }
145
+
146
+ return $response;
147
+ }
148
 
149
+ public function getMe() {
150
+ return $this->authUserData;
 
 
 
 
151
  }
152
 
153
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: social login, facebook, google, twitter, linkedin, register, login, social
4
  Donate link: https://www.facebook.com/nextendweb
5
  Requires at least: 4.5
6
  Tested up to: 4.9
7
- Stable tag: 3.0.10
8
  Requires PHP: 5.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -114,8 +114,18 @@ Unfortunately, currently there are no BuddyPress specific settings. However your
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
 
 
 
 
117
  = 3.0.10 =
118
- * Fix: display_post_states is static now
119
 
120
  = 3.0.9 =
121
  * Fix: Parse error for alternate login page
4
  Donate link: https://www.facebook.com/nextendweb
5
  Requires at least: 4.5
6
  Tested up to: 4.9
7
+ Stable tag: 3.0.11
8
  Requires PHP: 5.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
114
 
115
  == Changelog ==
116
 
117
+ = 3.0.11 =
118
+ * Fix: Twitter - 32bit and Windows servers are lost the id precision
119
+ * Feature: Jetpack SSO login form extension
120
+ * Feature: Prevent external redirect
121
+ * Feature: Added Debug menu and Provider connection test
122
+ * Theme My Login version 7 breaks Nextend Social Login, so notice displays with details
123
+
124
+ * PRO: Feature: Sync Google fields
125
+ * PRO: Feature: Sync Twitter fields
126
+
127
  = 3.0.10 =
128
+ * Fix: display_post_states is static now
129
 
130
  = 3.0.9 =
131
  * Fix: Parse error for alternate login page
template-parts/login/below.php CHANGED
@@ -1,18 +1,28 @@
1
  <script type="text/javascript">
2
  (function ($) {
3
  $(document).ready(function () {
4
- var $form = $('#loginform,#registerform,#front-login-form,#setupform'),
5
- $main = $('#nsl-custom-login-form-main');
6
-
7
- if ($form.parent().hasClass('tml')) {
8
- $form = $form.parent();
9
- }
10
 
11
  $main.find('.nsl-container')
12
  .addClass('nsl-container-login-layout-below')
13
  .css('display', 'block');
14
 
15
- $main.appendTo($form)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  });
17
  }(jQuery));
18
  </script>
@@ -29,6 +39,11 @@
29
  .login form {
30
  padding-bottom: 20px;
31
  }
 
 
 
 
 
32
  </style>
33
  <noscript>
34
  <style>
1
  <script type="text/javascript">
2
  (function ($) {
3
  $(document).ready(function () {
4
+ var $main = $('#nsl-custom-login-form-main');
 
 
 
 
 
5
 
6
  $main.find('.nsl-container')
7
  .addClass('nsl-container-login-layout-below')
8
  .css('display', 'block');
9
 
10
+
11
+ var $jetpackSSO = $('#jetpack-sso-wrap__action');
12
+ if ($jetpackSSO.length) {
13
+ $jetpackSSO
14
+ .append($main.clone().attr('id', 'nsl-custom-login-form-jetpack-sso'));
15
+
16
+ $main.insertBefore('#jetpack-sso-wrap');
17
+ } else {
18
+ var $form = $('#loginform,#registerform,#front-login-form,#setupform');
19
+
20
+ if ($form.parent().hasClass('tml')) {
21
+ $form = $form.parent();
22
+ }
23
+
24
+ $main.appendTo($form);
25
+ }
26
  });
27
  }(jQuery));
28
  </script>
39
  .login form {
40
  padding-bottom: 20px;
41
  }
42
+
43
+ #nsl-custom-login-form-jetpack-sso .nsl-container-login-layout-below {
44
+ clear: both;
45
+ padding: 0 0 20px;
46
+ }
47
  </style>
48
  <noscript>
49
  <style>