Revive Old Posts – Auto Post to Social Media - Version 8.5.1

Version Description

  • 2019-11-21 =

  • Fix PRO: LinkedIn invalid scope error on old installs

Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Revive Old Posts – Auto Post to Social Media
Version 8.5.1
Comparing to
See all releases

Code changes from version 8.5.0 to 8.5.1

CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
 
2
- ### v8.5.0 - 2019-11-21
 
 
 
 
3
  **Changes:**
4
- * update readme.txt
5
 
6
  ### v8.5.0 - 2019-11-21
7
  **Changes:**
1
 
2
+ ### v8.5.1 - 2019-12-10
3
+ **Changes:**
4
+ * add codeinwp and themeisle links to readme
5
+
6
+ ### v8.5.1 - 2019-11-21
7
  **Changes:**
8
+ * V851
9
 
10
  ### v8.5.0 - 2019-11-21
11
  **Changes:**
includes/admin/abstract/class-rop-services-abstract.php CHANGED
@@ -522,11 +522,16 @@ abstract class Rop_Services_Abstract {
522
  ),
523
 
524
  // LinkedIn errors
525
- ''submitted-url' can not be empty' => array(
526
  'message' => 'There might be an issue with link creations on your website.',
527
  'link' => 'https://is.gd/fix_link_issue',
528
  ),
529
 
 
 
 
 
 
530
  // Pinterest errors
531
  'Pinterest error (code: 429) with message: You have exceeded your rate limit' => array(
532
  'message' => 'You\'ve hit the Pinterest rate limit.',
522
  ),
523
 
524
  // LinkedIn errors
525
+ ''submitted-url' can not be empty' => array(
526
  'message' => 'There might be an issue with link creations on your website.',
527
  'link' => 'https://is.gd/fix_link_issue',
528
  ),
529
 
530
+ '[ unauthorized_scope_error ] Scope "r_organization_social"' => array(
531
+ 'message' => 'You might need to reconnect your LinkedIn account. ',
532
+ 'link' => 'https://is.gd/fix_linkedin_scope_error',
533
+ ),
534
+
535
  // Pinterest errors
536
  'Pinterest error (code: 429) with message: You have exceeded your rate limit' => array(
537
  'message' => 'You\'ve hit the Pinterest rate limit.',
includes/admin/services/class-rop-linkedin-service.php CHANGED
@@ -44,10 +44,20 @@ class Rop_Linkedin_Service extends Rop_Services_Abstract {
44
  * @var array $scopes The scopes to authorize with LinkedIn.
45
  */
46
  protected $scopes = array( 'r_liteprofile', 'r_emailaddress', 'w_member_social', 'r_organization_social', 'w_organization_social', 'rw_organization_admin');
47
- // protected $scopes = array( 'r_liteprofile', 'r_emailaddress', 'w_member_social', , 'w_organization_social');
 
 
 
 
 
 
 
 
 
 
 
 
48
  // Company(organization) sharing scope cannot be used unless app approved for this scope.
49
- // Added here for future reference
50
- // https://stackoverflow.com/questions/54821731/in-linkedin-api-v2-0-how-to-get-company-list-by-persons-token
51
  // https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program
52
 
53
 
@@ -105,6 +115,7 @@ class Rop_Linkedin_Service extends Rop_Services_Abstract {
105
  if ( isset( $_GET['error'], $_GET['error_description'] ) ) {
106
  $message = 'Linkedin Error: [ ' . $_GET['error'] . ' ] ' . html_entity_decode( urldecode( $_GET['error_description'] ) );
107
  $this->logger->alert_error( $message );
 
108
  }
109
  exit( wp_redirect( $this->get_legacy_url() ) );
110
  } else {
@@ -119,6 +130,7 @@ class Rop_Linkedin_Service extends Rop_Services_Abstract {
119
 
120
  $message = 'Linkedin Error: Code[ ' . $e->getCode() . ' ] ' . $e->getDescription();
121
  $this->logger->alert_error( $message );
 
122
  $referrer = $_SERVER['HTTP_REFERER'];
123
  // If the user is trying to authenticate.
124
  if ( ! empty( substr_count( $referrer, 'linkedin.com' ) ) ) {
@@ -325,36 +337,41 @@ class Rop_Linkedin_Service extends Rop_Services_Abstract {
325
 
326
  $users = array( $user_details );
327
 
328
- try {
 
 
329
 
330
- $admined_linkedin_pages = $this->api->api(
331
- // 'organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(organizationalTarget~(localizedName,vanityName,logoV2)))',
332
- 'organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED',
333
- array(),
334
- 'GET'
335
- );
336
 
337
- $all_organization_urns = array();
338
- foreach ( $admined_linkedin_pages as $key => $value ) {
339
 
340
- if ( $key === 'elements' ) {
341
 
342
- foreach ( $value as $key2 => $value2 ) {
343
 
344
- $organizationalTarget = $value2['organizationalTarget'];
345
 
346
- // urn:li:organization:5552231
347
- $parts = explode( ':', $organizationalTarget );
348
 
349
- if ( ! in_array( $parts[3], $all_organization_urns ) ) {
350
- $all_organization_urns[] = $parts[3];
 
351
  }
352
  }
353
  }
354
- }
355
- } catch ( Exception $e ) {
356
- $this->logger->alert_error( 'Got in exception: ' . $e );
357
 
 
 
 
358
  return $users;
359
  }
360
 
@@ -458,8 +475,15 @@ class Rop_Linkedin_Service extends Rop_Services_Abstract {
458
  $_SESSION['rop_linkedin_credentials'] = $credentials;
459
  $this->set_api( $credentials['client_id'], $credentials['secret'] );
460
  $api = $this->get_api();
461
- $url = $api->getLoginUrl( $this->scopes );
462
 
 
 
 
 
 
 
 
 
463
  return $url;
464
  }
465
 
@@ -482,7 +506,9 @@ class Rop_Linkedin_Service extends Rop_Services_Abstract {
482
  // check if linkedin Account was added using Revive Social app
483
  $added_with_app = get_option( 'rop_linkedin_via_rs_app' );
484
 
485
- if ( ! empty( $added_with_app ) ) {
 
 
486
  $token = new \LinkedIn\AccessToken( $args['credentials'] );
487
  } else {
488
  $this->set_api( $this->credentials['client_id'], $this->credentials['secret'] );
44
  * @var array $scopes The scopes to authorize with LinkedIn.
45
  */
46
  protected $scopes = array( 'r_liteprofile', 'r_emailaddress', 'w_member_social', 'r_organization_social', 'w_organization_social', 'rw_organization_admin');
47
+
48
+ /**
49
+ * Old permissions required by custom user apps.
50
+ *
51
+ * This does not try to pull in the company profile, just the user's profile.
52
+ * LinkedIn made it so that all new apps being created require company verification to work (which would give them the permissions in $scope).
53
+ * So this is only valid for old apps that were already created.
54
+ *
55
+ * @since 8.5.0
56
+ * @access protected
57
+ * @var array $scopes_old The scopes to authorize with LinkedIn.
58
+ */
59
+ protected $scopes_old = array( 'r_liteprofile', 'r_emailaddress', 'w_member_social');
60
  // Company(organization) sharing scope cannot be used unless app approved for this scope.
 
 
61
  // https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program
62
 
63
 
115
  if ( isset( $_GET['error'], $_GET['error_description'] ) ) {
116
  $message = 'Linkedin Error: [ ' . $_GET['error'] . ' ] ' . html_entity_decode( urldecode( $_GET['error_description'] ) );
117
  $this->logger->alert_error( $message );
118
+ $this->rop_get_error_docs( $message );
119
  }
120
  exit( wp_redirect( $this->get_legacy_url() ) );
121
  } else {
130
 
131
  $message = 'Linkedin Error: Code[ ' . $e->getCode() . ' ] ' . $e->getDescription();
132
  $this->logger->alert_error( $message );
133
+ $this->rop_get_error_docs( $message );
134
  $referrer = $_SERVER['HTTP_REFERER'];
135
  // If the user is trying to authenticate.
136
  if ( ! empty( substr_count( $referrer, 'linkedin.com' ) ) ) {
337
 
338
  $users = array( $user_details );
339
 
340
+ // only new installs can connect company accounts because they will have the organization scope
341
+ if ( $this->rop_show_li_app_btn() ) {
342
+ try {
343
 
344
+ $admined_linkedin_pages = $this->api->api(
345
+ // 'organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(organizationalTarget~(localizedName,vanityName,logoV2)))',
346
+ 'organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED',
347
+ array(),
348
+ 'GET'
349
+ );
350
 
351
+ $all_organization_urns = array();
352
+ foreach ( $admined_linkedin_pages as $key => $value ) {
353
 
354
+ if ( $key === 'elements' ) {
355
 
356
+ foreach ( $value as $key2 => $value2 ) {
357
 
358
+ $organizationalTarget = $value2['organizationalTarget'];
359
 
360
+ // urn:li:organization:5552231
361
+ $parts = explode( ':', $organizationalTarget );
362
 
363
+ if ( ! in_array( $parts[3], $all_organization_urns ) ) {
364
+ $all_organization_urns[] = $parts[3];
365
+ }
366
  }
367
  }
368
  }
369
+ } catch ( Exception $e ) {
370
+ $this->logger->alert_error( 'Got in exception: ' . $e );
 
371
 
372
+ return $users;
373
+ }
374
+ } else {
375
  return $users;
376
  }
377
 
475
  $_SESSION['rop_linkedin_credentials'] = $credentials;
476
  $this->set_api( $credentials['client_id'], $credentials['secret'] );
477
  $api = $this->get_api();
 
478
 
479
+ // NOTE: When we open up new linkedin login method for all users we need to give users a notice in their dashboard
480
+ // NOTE: Letting them know that they need to go through the upgrade process by connecting through our APP
481
+ // NOTE: Or we can simply keep them using their old app by keeping this rop_show_li_app_btn method which would be present only in this file and renaming it to something like rop_is_new_install
482
+ if ( $this->rop_show_li_app_btn() ) {
483
+ $url = $api->getLoginUrl( $this->scopes );
484
+ } else {
485
+ $url = $api->getLoginUrl( $this->scopes_old );
486
+ }
487
  return $url;
488
  }
489
 
506
  // check if linkedin Account was added using Revive Social app
507
  $added_with_app = get_option( 'rop_linkedin_via_rs_app' );
508
 
509
+ // if linkedin was connected with "Sign into Linkedin" button, use appropriate key for access token
510
+ // accounts added with "Sign into Linkedin" button will not have the ['credentials']['client_id'] array key
511
+ if ( ! empty( $added_with_app ) && empty( $args['credentials']['client_id'] ) ) {
512
  $token = new \LinkedIn\AccessToken( $args['credentials'] );
513
  } else {
514
  $this->set_api( $this->credentials['client_id'], $this->credentials['secret'] );
includes/class-rop.php CHANGED
@@ -68,7 +68,7 @@ class Rop {
68
  public function __construct() {
69
 
70
  $this->plugin_name = 'rop';
71
- $this->version = '8.5.0';
72
 
73
  $this->load_dependencies();
74
  $this->set_locale();
68
  public function __construct() {
69
 
70
  $this->plugin_name = 'rop';
71
+ $this->version = '8.5.1';
72
 
73
  $this->load_dependencies();
74
  $this->set_locale();
readme.md CHANGED
@@ -161,6 +161,9 @@ Post questions and issues on the [Support Forum](https://wordpress.org/support/p
161
  - See where ROP is headed, check out the roadmap [here](https://trello.com/b/svAZqXO1/roadmap-revive-old-posts).
162
  - For plugin documentation [see here](https://docs.revive.social/).
163
  - Read more about social media marketing on [our blog](https://revive.social/blog/).
 
 
 
164
 
165
 
166
  ### Translations ###
@@ -251,6 +254,11 @@ http://revive.social/plugins/revive-old-post
251
 
252
 
253
  ## Changelog ##
 
 
 
 
 
254
  ### 8.5.0 - 2019-11-21 ###
255
 
256
  * New PRO: Made it easier to connect LinkedIn Accounts for new installs
161
  - See where ROP is headed, check out the roadmap [here](https://trello.com/b/svAZqXO1/roadmap-revive-old-posts).
162
  - For plugin documentation [see here](https://docs.revive.social/).
163
  - Read more about social media marketing on [our blog](https://revive.social/blog/).
164
+ - Read more about WordPress on [our blog](https://www.codeinwp.com/blog/).
165
+ - Take a look at our other plugins [see here](https://themeisle.com/wordpress-plugins/).
166
+
167
 
168
 
169
  ### Translations ###
254
 
255
 
256
  ## Changelog ##
257
+ ### 8.5.1 - 2019-11-21 ###
258
+
259
+ * Fix PRO: LinkedIn invalid scope error on old installs
260
+
261
+
262
  ### 8.5.0 - 2019-11-21 ###
263
 
264
  * New PRO: Made it easier to connect LinkedIn Accounts for new installs
readme.txt CHANGED
@@ -161,6 +161,9 @@ Post questions and issues on the [Support Forum](https://wordpress.org/support/p
161
  - See where ROP is headed, check out the roadmap [here](https://trello.com/b/svAZqXO1/roadmap-revive-old-posts).
162
  - For plugin documentation [see here](https://docs.revive.social/).
163
  - Read more about social media marketing on [our blog](https://revive.social/blog/).
 
 
 
164
 
165
 
166
  = Translations =
@@ -251,6 +254,11 @@ http://revive.social/plugins/revive-old-post
251
 
252
 
253
  == Changelog ==
 
 
 
 
 
254
  = 8.5.0 - 2019-11-21 =
255
 
256
  * New PRO: Made it easier to connect LinkedIn Accounts for new installs
161
  - See where ROP is headed, check out the roadmap [here](https://trello.com/b/svAZqXO1/roadmap-revive-old-posts).
162
  - For plugin documentation [see here](https://docs.revive.social/).
163
  - Read more about social media marketing on [our blog](https://revive.social/blog/).
164
+ - Read more about WordPress on [our blog](https://www.codeinwp.com/blog/).
165
+ - Take a look at our other plugins [see here](https://themeisle.com/wordpress-plugins/).
166
+
167
 
168
 
169
  = Translations =
254
 
255
 
256
  == Changelog ==
257
+ = 8.5.1 - 2019-11-21 =
258
+
259
+ * Fix PRO: LinkedIn invalid scope error on old installs
260
+
261
+
262
  = 8.5.0 - 2019-11-21 =
263
 
264
  * New PRO: Made it easier to connect LinkedIn Accounts for new installs
themeisle-hash.json CHANGED
@@ -1 +1 @@
1
- {"class-rop-autoloader.php":"7bfbb1554230d0ace777adb2e42bebeb","index.php":"39ab8276fb0e4bd3fcab3270822c5977","tweet-old-post.php":"6fe416d8dc4e4bd25dca16f6e31c1246","uninstall.php":"559dd9ebfadc88c664e6b607e2cae8fd"}
1
+ {"class-rop-autoloader.php":"7bfbb1554230d0ace777adb2e42bebeb","index.php":"39ab8276fb0e4bd3fcab3270822c5977","tweet-old-post.php":"fa48c6ece0e9aa44a0ab34db1e2a7443","uninstall.php":"559dd9ebfadc88c664e6b607e2cae8fd"}
tweet-old-post.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: Revive Old Posts
17
  * Plugin URI: https://revive.social/
18
  * Description: WordPress plugin that helps you to keeps your old posts alive by sharing them and driving more traffic to them from twitter/facebook or linkedin. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
19
- * Version: 8.5.0
20
  * Author: revive.social
21
  * Author URI: https://revive.social/
22
  * Requires at least: 3.5
@@ -98,7 +98,7 @@ function run_rop() {
98
  }
99
 
100
  define( 'ROP_PRO_URL', 'http://revive.social/plugins/revive-old-post/' );
101
- define( 'ROP_LITE_VERSION', '8.5.0' );
102
  define( 'ROP_LITE_BASE_FILE', __FILE__ );
103
  define( 'ROP_DEBUG', false );
104
  define( 'ROP_LITE_PATH', plugin_dir_path( __FILE__ ) );
16
  * Plugin Name: Revive Old Posts
17
  * Plugin URI: https://revive.social/
18
  * Description: WordPress plugin that helps you to keeps your old posts alive by sharing them and driving more traffic to them from twitter/facebook or linkedin. It also helps you to promote your content. You can set time and no of posts to share to drive more traffic.For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
19
+ * Version: 8.5.1
20
  * Author: revive.social
21
  * Author URI: https://revive.social/
22
  * Requires at least: 3.5
98
  }
99
 
100
  define( 'ROP_PRO_URL', 'http://revive.social/plugins/revive-old-post/' );
101
+ define( 'ROP_LITE_VERSION', '8.5.1' );
102
  define( 'ROP_LITE_BASE_FILE', __FILE__ );
103
  define( 'ROP_DEBUG', false );
104
  define( 'ROP_LITE_PATH', plugin_dir_path( __FILE__ ) );
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitd8104aae9d5c78817e3f570f501a40b2::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit58cb613923fdcc2373a6b50b01097033::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitd8104aae9d5c78817e3f570f501a40b2
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitd8104aae9d5c78817e3f570f501a40b2
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitd8104aae9d5c78817e3f570f501a40b2', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitd8104aae9d5c78817e3f570f501a40b2', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInitd8104aae9d5c78817e3f570f501a40b2
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequired8104aae9d5c78817e3f570f501a40b2($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequired8104aae9d5c78817e3f570f501a40b2($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit58cb613923fdcc2373a6b50b01097033
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit58cb613923fdcc2373a6b50b01097033', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit58cb613923fdcc2373a6b50b01097033', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequire58cb613923fdcc2373a6b50b01097033($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
+ function composerRequire58cb613923fdcc2373a6b50b01097033($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;