WP to Twitter - Version 3.3.11

Version Description

  • Pass post ID to wpt_retweet_text filter.
  • Don't throw duplicate Tweet error if Tweet is blank.
Download this release

Release Info

Developer joedolson
Plugin Icon 128x128 WP to Twitter
Version 3.3.11
Comparing to
See all releases

Code changes from version 3.3.10 to 3.3.11

Files changed (2) hide show
  1. readme.txt +7 -2
  2. wp-to-twitter.php +10 -5
readme.txt CHANGED
@@ -3,11 +3,11 @@ Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: twitter, microblogging, su.pr, bitly, yourls, redirect, shortener, post, links, social, sharing, media, tweet
5
  Requires at least: 4.4
6
- Tested up to: 5.0
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
- Stable tag: 3.3.10
11
 
12
  Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
13
 
@@ -63,6 +63,11 @@ Check out my <a href="https://github.com/joedolson/plugin-extensions/tree/master
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
66
  = 3.3.10 =
67
 
68
  * Change: Display UI for post types that are private but have a UI (e.g., WooCommerce coupons)
3
  Donate link: http://www.joedolson.com/donate/
4
  Tags: twitter, microblogging, su.pr, bitly, yourls, redirect, shortener, post, links, social, sharing, media, tweet
5
  Requires at least: 4.4
6
+ Tested up to: 5.1
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
+ Stable tag: 3.3.11
11
 
12
  Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
13
 
63
 
64
  == Changelog ==
65
 
66
+ = 3.3.11 =
67
+
68
+ * Pass post ID to wpt_retweet_text filter.
69
+ * Don't throw duplicate Tweet error if Tweet is blank.
70
+
71
  = 3.3.10 =
72
 
73
  * Change: Display UI for post types that are private but have a UI (e.g., WooCommerce coupons)
wp-to-twitter.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WP to Twitter
6
  * @author Joe Dolson
7
- * @copyright 2008-2018 Joe Dolson
8
  * @license GPL-2.0+
9
  *
10
  * @wordpress-plugin
@@ -17,7 +17,7 @@
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
- * Version: 3.3.10
21
  */
22
 
23
  /*
@@ -57,7 +57,7 @@ require_once( plugin_dir_path( __FILE__ ) . 'wpt-widget.php' );
57
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
58
 
59
  global $wpt_version;
60
- $wpt_version = '3.3.10';
61
 
62
  add_action( 'init', 'wpt_load_textdomain' );
63
  /**
@@ -309,7 +309,7 @@ function wpt_post_to_twitter( $twit, $auth = false, $id = false, $media = false
309
 
310
  $check = ( ! $auth ) ? get_option( 'jd_last_tweet' ) : get_user_meta( $auth, 'wpt_last_tweet', true ); // get user's last tweet.
311
  // prevent duplicate Tweets.
312
- if ( $check == $twit ) {
313
  wpt_mail( 'Matched: tweet identical', "This Tweet: $twit; Check Tweet: $check; $auth, $id, $media", $id ); // DEBUG.
314
  $error = __( 'This tweet is identical to another Tweet recently sent to this account.', 'wp-to-twitter' ) . ' ' . __( 'Twitter requires all Tweets to be unique.', 'wp-to-twitter' );
315
  wpt_saves_error( $id, $auth, $twit, $error, '403-1', time() );
@@ -812,6 +812,7 @@ function wpt_tweet( $post_ID, $type = 'instant' ) {
812
  // identify whether limited by category/taxonomy.
813
  $continue = wpt_category_limit( $post_type, $post_info, $post_ID );
814
  if ( false == $continue ) {
 
815
  return false;
816
  }
817
  // create Tweet and ID whether current action is edit or new.
@@ -919,8 +920,12 @@ function wpt_tweet( $post_ID, $type = 'instant' ) {
919
  for ( $i = 1; $i <= $repeat; $i ++ ) {
920
  $continue = apply_filters( 'wpt_allow_reposts', true, $i, $post_ID, $acct );
921
  if ( $continue ) {
922
- $retweet = apply_filters( 'wpt_set_retweet_text', $template, $i );
923
  $retweet = jd_truncate_tweet( $retweet, $post_info, $post_ID, true, $acct );
 
 
 
 
924
  // add original delay to schedule.
925
  $delay = ( isset( $post_info['wpt_delay_tweet'] ) ) ? ( (int) $post_info['wpt_delay_tweet'] ) * 60 : 0;
926
  // Don't delay the first Tweet of the group.
4
  *
5
  * @package WP to Twitter
6
  * @author Joe Dolson
7
+ * @copyright 2008-2019 Joe Dolson
8
  * @license GPL-2.0+
9
  *
10
  * @wordpress-plugin
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
+ * Version: 3.3.11
21
  */
22
 
23
  /*
57
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
58
 
59
  global $wpt_version;
60
+ $wpt_version = '3.3.11';
61
 
62
  add_action( 'init', 'wpt_load_textdomain' );
63
  /**
309
 
310
  $check = ( ! $auth ) ? get_option( 'jd_last_tweet' ) : get_user_meta( $auth, 'wpt_last_tweet', true ); // get user's last tweet.
311
  // prevent duplicate Tweets.
312
+ if ( $check == $twit && '' != $twit ) {
313
  wpt_mail( 'Matched: tweet identical', "This Tweet: $twit; Check Tweet: $check; $auth, $id, $media", $id ); // DEBUG.
314
  $error = __( 'This tweet is identical to another Tweet recently sent to this account.', 'wp-to-twitter' ) . ' ' . __( 'Twitter requires all Tweets to be unique.', 'wp-to-twitter' );
315
  wpt_saves_error( $id, $auth, $twit, $error, '403-1', time() );
812
  // identify whether limited by category/taxonomy.
813
  $continue = wpt_category_limit( $post_type, $post_info, $post_ID );
814
  if ( false == $continue ) {
815
+ wpt_mail( '4b: Limited by category filters', print_r( $post_info, 1 ), $post_ID );
816
  return false;
817
  }
818
  // create Tweet and ID whether current action is edit or new.
920
  for ( $i = 1; $i <= $repeat; $i ++ ) {
921
  $continue = apply_filters( 'wpt_allow_reposts', true, $i, $post_ID, $acct );
922
  if ( $continue ) {
923
+ $retweet = apply_filters( 'wpt_set_retweet_text', $template, $i, $post_ID );
924
  $retweet = jd_truncate_tweet( $retweet, $post_info, $post_ID, true, $acct );
925
+ if ( '' == $retweet ) {
926
+ // If a filter sets this value to empty, exit without scheduling.
927
+ return $post_ID;
928
+ }
929
  // add original delay to schedule.
930
  $delay = ( isset( $post_info['wpt_delay_tweet'] ) ) ? ( (int) $post_info['wpt_delay_tweet'] ) * 60 : 0;
931
  // Don't delay the first Tweet of the group.