WP to Twitter - Version 3.3.10

Version Description

  • Change: Display UI for post types that are private but have a UI (e.g., WooCommerce coupons)
  • Bug fix: User permissions for connecting to Oauth overrode ability to enter personal settings.
  • Bug fix: Exit meta migration if post does not exist.
Download this release

Release Info

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

Code changes from version 3.3.9 to 3.3.10

js/tabs.js CHANGED
@@ -1,29 +1,29 @@
1
  jQuery(document).ready(function ($) {
2
- var tabs = $('.wpt-settings .wptab').length;
3
- $('.wpt-settings .tabs a[href="#' + firstItem + '"]').addClass('active').attr( 'aria-selected', 'true' );
4
- if (tabs > 1) {
5
- $('.wpt-settings .wptab').not('#' + firstItem).hide();
6
- $('.wpt-settings .tabs a').on('click', function (e) {
7
- e.preventDefault();
8
- $('.wpt-settings .tabs a').removeClass('active').attr( 'aria-selected', 'false' );
9
- $(this).addClass('active').attr( 'aria-selected', 'true' );
10
- var target = $(this).attr('href');
11
- $('.wpt-settings .wptab').not(target).hide();
12
- $(target).show().attr( 'tabindex', '-1' ).focus();
13
- });
14
- };
15
-
16
- var permissions = $('.wpt-permissions .wptab').length;
17
- $('.wpt-permissions .tabs a[href="#' + firstPerm + '"]').addClass('active').attr( 'aria-selected', 'true' );
18
- if (permissions > 1) {
19
- $('.wpt-permissions .wptab').not('#' + firstPerm).hide();
20
- $('.wpt-permissions .tabs a').on('click', function (e) {
21
- e.preventDefault();
22
- $('.wpt-permissions .tabs a').removeClass('active').attr( 'aria-selected', 'false' );
23
- $(this).addClass('active').attr( 'aria-selected', 'true' );
24
- var target = $(this).attr('href');
25
- $('.wpt-permissions .wptab').not(target).hide();
26
- $(target).show().attr( 'tabindex', '-1' ).focus();
27
- });
28
- };
29
  });
1
  jQuery(document).ready(function ($) {
2
+ var tabs = $('.wpt-settings .wptab').length;
3
+ $('.wpt-settings .tabs a[href="#' + firstItem + '"]').addClass('active').attr( 'aria-selected', 'true' );
4
+ if (tabs > 1) {
5
+ $('.wpt-settings .wptab').not('#' + firstItem).hide();
6
+ $('.wpt-settings .tabs a').on('click', function (e) {
7
+ e.preventDefault();
8
+ $('.wpt-settings .tabs a').removeClass('active').attr( 'aria-selected', 'false' );
9
+ $(this).addClass('active').attr( 'aria-selected', 'true' );
10
+ var target = $(this).attr('href');
11
+ $('.wpt-settings .wptab').not(target).hide();
12
+ $(target).show().attr( 'tabindex', '-1' ).focus();
13
+ });
14
+ };
15
+
16
+ var permissions = $('.wpt-permissions .wptab').length;
17
+ $('.wpt-permissions .tabs a[href="#' + firstPerm + '"]').addClass('active').attr( 'aria-selected', 'true' );
18
+ if (permissions > 1) {
19
+ $('.wpt-permissions .wptab').not('#' + firstPerm).hide();
20
+ $('.wpt-permissions .tabs a').on('click', function (e) {
21
+ e.preventDefault();
22
+ $('.wpt-permissions .tabs a').removeClass('active').attr( 'aria-selected', 'false' );
23
+ $(this).addClass('active').attr( 'aria-selected', 'true' );
24
+ var target = $(this).attr('href');
25
+ $('.wpt-permissions .wptab').not(target).hide();
26
+ $(target).show().attr( 'tabindex', '-1' ).focus();
27
+ });
28
+ };
29
  });
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: 4.9
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
- Stable tag: 3.3.9
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,12 @@ Check out my <a href="https://github.com/joedolson/plugin-extensions/tree/master
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
66
  = 3.3.9 =
67
 
68
  * Added filter to cancel Tweets for custom reasons after all other filters executed.
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
 
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)
69
+ * Bug fix: User permissions for connecting to Oauth overrode ability to enter personal settings.
70
+ * Bug fix: Exit meta migration if post does not exist.
71
+
72
  = 3.3.9 =
73
 
74
  * Added filter to cancel Tweets for custom reasons after all other filters executed.
wp-to-twitter-manager.php CHANGED
@@ -306,10 +306,14 @@ function wpt_update_settings() {
306
  <?php
307
  echo apply_filters( 'wpt_tweet_length', '' );
308
  echo apply_filters( 'wpt_pick_shortener', '' );
309
- $post_types = get_post_types( array( 'public' => true ), 'objects' );
310
  $wpt_settings = get_option( 'wpt_post_types' );
311
  $tabs = "<ul class='tabs' role='tablist'>";
312
  foreach ( $post_types as $type ) {
 
 
 
 
313
  $name = $type->labels->name;
314
  $slug = $type->name;
315
  if ( 'attachment' == $slug || 'nav_menu_item' == $slug || 'revision' == $slug ) {
@@ -320,6 +324,9 @@ function wpt_update_settings() {
320
  $tabs .= "<li><a href='#wpt_links' id='tab_wpt_links' aria-controls='wpt_links'>" . __( 'Links', 'wp-to-twitter' ) . '</a></li></ul>';
321
  echo $tabs;
322
  foreach ( $post_types as $type ) {
 
 
 
323
  $name = $type->labels->name;
324
  $slug = $type->name;
325
  if ( 'attachment' == $slug || 'nav_menu_item' == $slug || 'revision' == $slug ) {
306
  <?php
307
  echo apply_filters( 'wpt_tweet_length', '' );
308
  echo apply_filters( 'wpt_pick_shortener', '' );
309
+ $post_types = get_post_types( array(), 'objects' );
310
  $wpt_settings = get_option( 'wpt_post_types' );
311
  $tabs = "<ul class='tabs' role='tablist'>";
312
  foreach ( $post_types as $type ) {
313
+ // If post type is both private & has no UI, don't show.
314
+ if ( false == $type->public && false == $type->show_ui ) {
315
+ continue;
316
+ }
317
  $name = $type->labels->name;
318
  $slug = $type->name;
319
  if ( 'attachment' == $slug || 'nav_menu_item' == $slug || 'revision' == $slug ) {
324
  $tabs .= "<li><a href='#wpt_links' id='tab_wpt_links' aria-controls='wpt_links'>" . __( 'Links', 'wp-to-twitter' ) . '</a></li></ul>';
325
  echo $tabs;
326
  foreach ( $post_types as $type ) {
327
+ if ( false == $type->public && false == $type->show_ui ) {
328
+ continue;
329
+ }
330
  $name = $type->labels->name;
331
  $slug = $type->name;
332
  if ( 'attachment' == $slug || 'nav_menu_item' == $slug || 'revision' == $slug ) {
wp-to-twitter-users.php CHANGED
@@ -30,7 +30,7 @@ function wpt_twitter_profile() {
30
  $is_enabled = get_user_meta( $user_edit, 'wp-to-twitter-enable-user', true );
31
  $twitter_username = get_user_meta( $user_edit, 'wp-to-twitter-user-username', true );
32
  $wpt_remove = get_user_meta( $user_edit, 'wpt-remove', true );
33
- if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
34
  ?>
35
  <h3><?php _e( 'WP Tweets User Settings', 'wp-to-twitter' ); ?></h3>
36
  <?php
@@ -64,7 +64,7 @@ function wpt_twitter_profile() {
64
  <?php echo apply_filters( 'wpt_twitter_user_fields', $user_edit ); ?>
65
  </table>
66
  <?php
67
- if ( function_exists( 'wpt_schedule_tweet' ) ) {
68
  if ( function_exists( 'wtt_connect_oauth' ) ) {
69
  wtt_connect_oauth( $user_edit );
70
  }
30
  $is_enabled = get_user_meta( $user_edit, 'wp-to-twitter-enable-user', true );
31
  $twitter_username = get_user_meta( $user_edit, 'wp-to-twitter-user-username', true );
32
  $wpt_remove = get_user_meta( $user_edit, 'wpt-remove', true );
33
+ if ( $current_user->ID == $user_ID || current_user_can( 'manage_options' ) ) {
34
  ?>
35
  <h3><?php _e( 'WP Tweets User Settings', 'wp-to-twitter' ); ?></h3>
36
  <?php
64
  <?php echo apply_filters( 'wpt_twitter_user_fields', $user_edit ); ?>
65
  </table>
66
  <?php
67
+ if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
68
  if ( function_exists( 'wtt_connect_oauth' ) ) {
69
  wtt_connect_oauth( $user_edit );
70
  }
wp-to-twitter.php CHANGED
@@ -17,11 +17,11 @@
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.9
21
  */
22
 
23
  /*
24
- Copyright 2008-2018 Joe Dolson (email : joe@joedolson.com)
25
 
26
  This program is free software; you can redistribute it and/or modify
27
  it under the terms of the GNU General Public License as published by
@@ -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.9';
61
 
62
  add_action( 'init', 'wpt_load_textdomain' );
63
  /**
@@ -891,15 +891,15 @@ function wpt_tweet( $post_ID, $type = 'instant' ) {
891
  "7a: Tweet Scheduled for author $author_id",
892
  print_r(
893
  array(
894
- 'id' => $acct,
895
- 'sentence' => $sentence,
896
- 'rt' => 0,
897
- 'post_id' => $post_ID,
898
- 'timestamp' => time() + $time + $offset,
899
  'current_time' => time(),
900
- 'timezone' => get_option( 'gmt_offset' ),
901
- 'timestring' => date( 'Y-m-d H:i:s', time() + $time + $offset ),
902
- 'current_ts' => date( 'Y-m-d H:i:s', time() ),
903
  ),
904
  1
905
  ),
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
  /*
24
+ Copyright 2008-2019 Joe Dolson (email : joe@joedolson.com)
25
 
26
  This program is free software; you can redistribute it and/or modify
27
  it under the terms of the GNU General Public License as published by
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
  /**
891
  "7a: Tweet Scheduled for author $author_id",
892
  print_r(
893
  array(
894
+ 'id' => $acct,
895
+ 'sentence' => $sentence,
896
+ 'rt' => 0,
897
+ 'post_id' => $post_ID,
898
+ 'timestamp' => time() + $time + $offset,
899
  'current_time' => time(),
900
+ 'timezone' => get_option( 'gmt_offset' ),
901
+ 'timestring' => date( 'Y-m-d H:i:s', time() + $time + $offset ),
902
+ 'current_ts' => date( 'Y-m-d H:i:s', time() ),
903
  ),
904
  1
905
  ),
wpt-functions.php CHANGED
@@ -822,7 +822,7 @@ function wpt_migrate_url_meta() {
822
  }
823
 
824
  $post = get_post( $post_id );
825
- if ( strtotime( $post->post_date ) > 1449764285 ) {
826
  // if this post was added after the migration function was added, it will not need to be migrated. Guaranteed.
827
  return;
828
  }
822
  }
823
 
824
  $post = get_post( $post_id );
825
+ if ( ! $post || strtotime( $post->post_date ) > 1449764285 ) {
826
  // if this post was added after the migration function was added, it will not need to be migrated. Guaranteed.
827
  return;
828
  }