bbPress - Version 2.5.14

Version Description

  • Improved support for PHP 7.1 and higher
  • Improved pagination for non-public post statuses
  • Fix converter row-limit boundaries
Download this release

Release Info

Developer johnjamesjacoby
Plugin Icon 128x128 bbPress
Version 2.5.14
Comparing to
See all releases

Code changes from version 2.5.13 to 2.5.14

bbpress.php CHANGED
@@ -5,7 +5,7 @@
5
  *
6
  * bbPress is forum software with a twist from the creators of WordPress.
7
  *
8
- * $Id: bbpress.php 6411 2017-05-18 13:11:03Z johnjamesjacoby $
9
  *
10
  * @package bbPress
11
  * @subpackage Main
@@ -17,7 +17,7 @@
17
  * Description: bbPress is forum software with a twist from the creators of WordPress.
18
  * Author: The bbPress Community
19
  * Author URI: https://bbpress.org
20
- * Version: 2.5.13
21
  * Text Domain: bbpress
22
  * Domain Path: /languages/
23
  */
@@ -190,7 +190,7 @@ final class bbPress {
190
 
191
  /** Versions **********************************************************/
192
 
193
- $this->version = '2.5.13-6410';
194
  $this->db_version = '250';
195
 
196
  /** Paths *************************************************************/
5
  *
6
  * bbPress is forum software with a twist from the creators of WordPress.
7
  *
8
+ * $Id: bbpress.php 6686 2017-09-09 15:04:06Z johnjamesjacoby $
9
  *
10
  * @package bbPress
11
  * @subpackage Main
17
  * Description: bbPress is forum software with a twist from the creators of WordPress.
18
  * Author: The bbPress Community
19
  * Author URI: https://bbpress.org
20
+ * Version: 2.5.14
21
  * Text Domain: bbpress
22
  * Domain Path: /languages/
23
  */
190
 
191
  /** Versions **********************************************************/
192
 
193
+ $this->version = '2.5.14-6684';
194
  $this->db_version = '250';
195
 
196
  /** Paths *************************************************************/
includes/admin/converter.php CHANGED
@@ -322,12 +322,12 @@ class BBP_Converter {
322
 
323
  $step = (int) get_option( '_bbp_converter_step', 1 );
324
  $min = (int) get_option( '_bbp_converter_start', 0 );
325
- $count = (int) ! empty( $_POST['_bbp_converter_rows'] ) ? $_POST['_bbp_converter_rows'] : 100;
326
  $max = ( $min + $count ) - 1;
327
  $start = $min;
328
 
329
  // Bail if platform did not get saved
330
- $platform = !empty( $_POST['_bbp_converter_platform' ] ) ? $_POST['_bbp_converter_platform' ] : get_option( '_bbp_converter_platform' );
331
  if ( empty( $platform ) )
332
  return;
333
 
@@ -651,10 +651,19 @@ abstract class BBP_Converter_Base {
651
 
652
  /** Get database connections ******************************************/
653
 
654
- $this->wpdb = $wpdb;
655
- $this->max_rows = (int) $_POST['_bbp_converter_rows'];
656
- $this->opdb = new wpdb( $_POST['_bbp_converter_db_user'], $_POST['_bbp_converter_db_pass'], $_POST['_bbp_converter_db_name'], $_POST['_bbp_converter_db_server'] );
657
- $this->opdb->prefix = $_POST['_bbp_converter_db_prefix'];
 
 
 
 
 
 
 
 
 
658
 
659
  /**
660
  * Error Reporting
322
 
323
  $step = (int) get_option( '_bbp_converter_step', 1 );
324
  $min = (int) get_option( '_bbp_converter_start', 0 );
325
+ $count = ! empty( $_POST['_bbp_converter_rows'] ) ? min( max( (int) $_POST['_bbp_converter_rows'], 1 ), 5000 ) : 100;
326
  $max = ( $min + $count ) - 1;
327
  $start = $min;
328
 
329
  // Bail if platform did not get saved
330
+ $platform = !empty( $_POST['_bbp_converter_platform' ] ) ? sanitize_text_field( $_POST['_bbp_converter_platform' ] ) : get_option( '_bbp_converter_platform' );
331
  if ( empty( $platform ) )
332
  return;
333
 
651
 
652
  /** Get database connections ******************************************/
653
 
654
+ $this->wpdb = $wpdb;
655
+ $this->max_rows = ! empty( $_POST['_bbp_converter_rows'] )
656
+ ? min( max( (int) $_POST['_bbp_converter_rows'], 1 ), 5000 )
657
+ : 100;
658
+
659
+ $this->opdb = new wpdb(
660
+ sanitize_text_field( $_POST['_bbp_converter_db_user'] ),
661
+ sanitize_text_field( $_POST['_bbp_converter_db_pass'] ),
662
+ sanitize_text_field( $_POST['_bbp_converter_db_name'] ),
663
+ sanitize_text_field( $_POST['_bbp_converter_db_server'] )
664
+ );
665
+
666
+ $this->opdb->prefix = sanitize_text_field( $_POST['_bbp_converter_db_prefix'] );
667
 
668
  /**
669
  * Error Reporting
includes/common/functions.php CHANGED
@@ -496,6 +496,9 @@ function bbp_get_statistics( $args = '' ) {
496
 
497
  if ( current_user_can( 'read_private_topics' ) || current_user_can( 'edit_others_topics' ) || current_user_can( 'view_trash' ) ) {
498
 
 
 
 
499
  // Private
500
  $topics['private'] = ( !empty( $r['count_private_topics'] ) && current_user_can( 'read_private_topics' ) ) ? (int) $all_topics->{$private} : 0;
501
 
@@ -528,6 +531,9 @@ function bbp_get_statistics( $args = '' ) {
528
 
529
  if ( current_user_can( 'read_private_replies' ) || current_user_can( 'edit_others_replies' ) || current_user_can( 'view_trash' ) ) {
530
 
 
 
 
531
  // Private
532
  $replies['private'] = ( !empty( $r['count_private_replies'] ) && current_user_can( 'read_private_replies' ) ) ? (int) $all_replies->{$private} : 0;
533
 
@@ -1633,35 +1639,12 @@ function bbp_get_all_child_ids( $parent_id = 0, $post_type = 'post' ) {
1633
  // Check for cache and set if needed
1634
  $child_ids = wp_cache_get( $cache_id, 'bbpress_posts' );
1635
  if ( false === $child_ids ) {
1636
- $post_status = array( bbp_get_public_status_id() );
1637
-
1638
- // Extra post statuses based on post type
1639
- switch ( $post_type ) {
1640
-
1641
- // Forum
1642
- case bbp_get_forum_post_type() :
1643
- $post_status[] = bbp_get_private_status_id();
1644
- $post_status[] = bbp_get_hidden_status_id();
1645
- break;
1646
-
1647
- // Topic
1648
- case bbp_get_topic_post_type() :
1649
- $post_status[] = bbp_get_closed_status_id();
1650
- $post_status[] = bbp_get_trash_status_id();
1651
- $post_status[] = bbp_get_spam_status_id();
1652
- break;
1653
-
1654
- // Reply
1655
- case bbp_get_reply_post_type() :
1656
- $post_status[] = bbp_get_trash_status_id();
1657
- $post_status[] = bbp_get_spam_status_id();
1658
- break;
1659
- }
1660
 
1661
- // Join post statuses together
1662
- $post_status = "'" . implode( "', '", $post_status ) . "'";
 
1663
 
1664
- $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) );
1665
  wp_cache_set( $cache_id, $child_ids, 'bbpress_posts' );
1666
  }
1667
 
496
 
497
  if ( current_user_can( 'read_private_topics' ) || current_user_can( 'edit_others_topics' ) || current_user_can( 'view_trash' ) ) {
498
 
499
+ // Declare empty arrays
500
+ $topics = $topic_titles = array();
501
+
502
  // Private
503
  $topics['private'] = ( !empty( $r['count_private_topics'] ) && current_user_can( 'read_private_topics' ) ) ? (int) $all_topics->{$private} : 0;
504
 
531
 
532
  if ( current_user_can( 'read_private_replies' ) || current_user_can( 'edit_others_replies' ) || current_user_can( 'view_trash' ) ) {
533
 
534
+ // Declare empty arrays
535
+ $replies = $reply_titles = array();
536
+
537
  // Private
538
  $replies['private'] = ( !empty( $r['count_private_replies'] ) && current_user_can( 'read_private_replies' ) ) ? (int) $all_replies->{$private} : 0;
539
 
1639
  // Check for cache and set if needed
1640
  $child_ids = wp_cache_get( $cache_id, 'bbpress_posts' );
1641
  if ( false === $child_ids ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1642
 
1643
+ // Join post statuses to specifically exclude together
1644
+ $not_in = array( 'draft', 'future' );
1645
+ $post_status = "'" . implode( "', '", $not_in ) . "'";
1646
 
1647
+ $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status NOT IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) );
1648
  wp_cache_set( $cache_id, $child_ids, 'bbpress_posts' );
1649
  }
1650
 
includes/common/template.php CHANGED
@@ -1819,6 +1819,8 @@ function bbp_the_content( $args = array() ) {
1819
  */
1820
  function bbp_get_tiny_mce_plugins( $plugins = array() ) {
1821
 
 
 
1822
  // Unset fullscreen
1823
  foreach ( $plugins as $key => $value ) {
1824
  if ( 'fullscreen' === $value ) {
1819
  */
1820
  function bbp_get_tiny_mce_plugins( $plugins = array() ) {
1821
 
1822
+ $plugins = (array) $plugins;
1823
+
1824
  // Unset fullscreen
1825
  foreach ( $plugins as $key => $value ) {
1826
  if ( 'fullscreen' === $value ) {
includes/common/widgets.php CHANGED
@@ -847,10 +847,18 @@ class BBP_Topics_Widget extends WP_Widget {
847
  $instance['title'] = strip_tags( $new_instance['title'] );
848
  $instance['order_by'] = strip_tags( $new_instance['order_by'] );
849
  $instance['parent_forum'] = sanitize_text_field( $new_instance['parent_forum'] );
850
- $instance['show_date'] = (bool) $new_instance['show_date'];
851
- $instance['show_user'] = (bool) $new_instance['show_user'];
852
  $instance['max_shown'] = (int) $new_instance['max_shown'];
853
 
 
 
 
 
 
 
 
 
 
 
854
  // Force to any
855
  if ( !empty( $instance['parent_forum'] ) && !is_numeric( $instance['parent_forum'] ) ) {
856
  $instance['parent_forum'] = 'any';
@@ -1210,10 +1218,18 @@ class BBP_Replies_Widget extends WP_Widget {
1210
  public function update( $new_instance = array(), $old_instance = array() ) {
1211
  $instance = $old_instance;
1212
  $instance['title'] = strip_tags( $new_instance['title'] );
1213
- $instance['show_date'] = (bool) $new_instance['show_date'];
1214
- $instance['show_user'] = (bool) $new_instance['show_user'];
1215
  $instance['max_shown'] = (int) $new_instance['max_shown'];
1216
 
 
 
 
 
 
 
 
 
 
 
1217
  return $instance;
1218
  }
1219
 
847
  $instance['title'] = strip_tags( $new_instance['title'] );
848
  $instance['order_by'] = strip_tags( $new_instance['order_by'] );
849
  $instance['parent_forum'] = sanitize_text_field( $new_instance['parent_forum'] );
 
 
850
  $instance['max_shown'] = (int) $new_instance['max_shown'];
851
 
852
+ // Date
853
+ $instance['show_date'] = isset( $new_instance['show_date'] )
854
+ ? (bool) $new_instance['show_date']
855
+ : false;
856
+
857
+ // Author
858
+ $instance['show_user'] = isset( $new_instance['show_user'] )
859
+ ? (bool) $new_instance['show_user']
860
+ : false;
861
+
862
  // Force to any
863
  if ( !empty( $instance['parent_forum'] ) && !is_numeric( $instance['parent_forum'] ) ) {
864
  $instance['parent_forum'] = 'any';
1218
  public function update( $new_instance = array(), $old_instance = array() ) {
1219
  $instance = $old_instance;
1220
  $instance['title'] = strip_tags( $new_instance['title'] );
 
 
1221
  $instance['max_shown'] = (int) $new_instance['max_shown'];
1222
 
1223
+ // Date
1224
+ $instance['show_date'] = isset( $new_instance['show_date'] )
1225
+ ? (bool) $new_instance['show_date']
1226
+ : false;
1227
+
1228
+ // Author
1229
+ $instance['show_user'] = isset( $new_instance['show_user'] )
1230
+ ? (bool) $new_instance['show_user']
1231
+ : false;
1232
+
1233
  return $instance;
1234
  }
1235
 
includes/forums/functions.php CHANGED
@@ -1797,7 +1797,7 @@ function bbp_pre_get_posts_normalize_forum_visibility( $posts_query = null ) {
1797
 
1798
  // Default to public status
1799
  if ( empty( $post_stati ) ) {
1800
- $post_stati[] = bbp_get_public_status_id();
1801
 
1802
  // Split the status string
1803
  } elseif ( is_string( $post_stati ) ) {
@@ -1848,7 +1848,7 @@ function bbp_pre_get_posts_normalize_forum_visibility( $posts_query = null ) {
1848
  }
1849
 
1850
  // Get any existing meta queries
1851
- $meta_query = $posts_query->get( 'meta_query', array() );
1852
 
1853
  // Add our meta query to existing
1854
  $meta_query[] = $forum_ids;
1797
 
1798
  // Default to public status
1799
  if ( empty( $post_stati ) ) {
1800
+ $post_stati = array( bbp_get_public_status_id() );
1801
 
1802
  // Split the status string
1803
  } elseif ( is_string( $post_stati ) ) {
1848
  }
1849
 
1850
  // Get any existing meta queries
1851
+ $meta_query = (array) $posts_query->get( 'meta_query', array() );
1852
 
1853
  // Add our meta query to existing
1854
  $meta_query[] = $forum_ids;
includes/forums/template.php CHANGED
@@ -680,7 +680,7 @@ function bbp_forum_get_subforums( $args = '' ) {
680
  $args = array( 'post_parent' => $args );
681
 
682
  // Setup possible post__not_in array
683
- $post_stati[] = bbp_get_public_status_id();
684
 
685
  // Super admin get whitelisted post statuses
686
  if ( bbp_is_user_keymaster() ) {
680
  $args = array( 'post_parent' => $args );
681
 
682
  // Setup possible post__not_in array
683
+ $post_stati = array( bbp_get_public_status_id() );
684
 
685
  // Super admin get whitelisted post statuses
686
  if ( bbp_is_user_keymaster() ) {
includes/replies/template.php CHANGED
@@ -1234,6 +1234,8 @@ function bbp_reply_author_link( $args = '' ) {
1234
  // Add links if not anonymous and existing user
1235
  if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) {
1236
 
 
 
1237
  // Assemble the links
1238
  foreach ( $author_links as $link => $link_text ) {
1239
  $link_class = ' class="bbp-author-' . $link . '"';
1234
  // Add links if not anonymous and existing user
1235
  if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) {
1236
 
1237
+ $author_link = array();
1238
+
1239
  // Assemble the links
1240
  foreach ( $author_links as $link => $link_text ) {
1241
  $link_class = ' class="bbp-author-' . $link . '"';
includes/topics/template.php CHANGED
@@ -1505,6 +1505,8 @@ function bbp_topic_author_link( $args = '' ) {
1505
  // Add links if not anonymous
1506
  if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) {
1507
 
 
 
1508
  // Assemble the links
1509
  foreach ( $author_links as $link => $link_text ) {
1510
  $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"';
@@ -3802,33 +3804,20 @@ function bbp_form_topic_tags() {
3802
  break;
3803
  }
3804
 
 
 
3805
  // Topic exists
3806
  if ( !empty( $topic_id ) ) {
3807
 
3808
  // Topic is spammed so display pre-spam terms
3809
  if ( bbp_is_topic_spam( $topic_id ) ) {
3810
-
3811
- // Get pre-spam terms
3812
  $new_terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true );
3813
 
3814
- // If terms exist, explode them and compile the return value
3815
- if ( empty( $new_terms ) ) {
3816
- $new_terms = '';
3817
- }
3818
-
3819
  // Topic is not spam so get real terms
3820
  } else {
3821
- $terms = array_filter( (array) get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() ) );
3822
-
3823
- // Loop through them
3824
- foreach ( $terms as $term ) {
3825
- $new_terms[] = $term->name;
3826
- }
3827
  }
3828
-
3829
- // Define local variable(s)
3830
- } else {
3831
- $new_terms = '';
3832
  }
3833
 
3834
  // Set the return value
1505
  // Add links if not anonymous
1506
  if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) {
1507
 
1508
+ $author_link = array();
1509
+
1510
  // Assemble the links
1511
  foreach ( $author_links as $link => $link_text ) {
1512
  $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"';
3804
  break;
3805
  }
3806
 
3807
+ $new_terms = array();
3808
+
3809
  // Topic exists
3810
  if ( !empty( $topic_id ) ) {
3811
 
3812
  // Topic is spammed so display pre-spam terms
3813
  if ( bbp_is_topic_spam( $topic_id ) ) {
 
 
3814
  $new_terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true );
3815
 
 
 
 
 
 
3816
  // Topic is not spam so get real terms
3817
  } else {
3818
+ $terms = array_filter( (array) get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() ) );
3819
+ $new_terms = wp_list_pluck( $terms, 'name' );
 
 
 
 
3820
  }
 
 
 
 
3821
  }
3822
 
3823
  // Set the return value
includes/users/template.php CHANGED
@@ -1658,6 +1658,9 @@ function bbp_author_link( $args = '' ) {
1658
 
1659
  $anonymous = bbp_is_reply_anonymous( $r['post_id'] );
1660
 
 
 
 
1661
  // Get avatar
1662
  if ( 'avatar' === $r['type'] || 'both' === $r['type'] ) {
1663
  $author_links[] = get_avatar( $user_id, $r['size'] );
@@ -1671,6 +1674,7 @@ function bbp_author_link( $args = '' ) {
1671
  // Add links if not anonymous
1672
  if ( empty( $anonymous ) && bbp_user_has_profile( $user_id ) ) {
1673
  $author_url = bbp_get_user_profile_url( $user_id );
 
1674
  foreach ( $author_links as $link_text ) {
1675
  $author_link[] = sprintf( '<a href="%1$s"%2$s>%3$s</a>', esc_url( $author_url ), $link_title, $link_text );
1676
  }
1658
 
1659
  $anonymous = bbp_is_reply_anonymous( $r['post_id'] );
1660
 
1661
+ // Declare empty array
1662
+ $author_links = array();
1663
+
1664
  // Get avatar
1665
  if ( 'avatar' === $r['type'] || 'both' === $r['type'] ) {
1666
  $author_links[] = get_avatar( $user_id, $r['size'] );
1674
  // Add links if not anonymous
1675
  if ( empty( $anonymous ) && bbp_user_has_profile( $user_id ) ) {
1676
  $author_url = bbp_get_user_profile_url( $user_id );
1677
+ $author_link = array();
1678
  foreach ( $author_links as $link_text ) {
1679
  $author_link[] = sprintf( '<a href="%1$s"%2$s>%3$s</a>', esc_url( $author_url ), $link_title, $link_text );
1680
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: matt, johnjamesjacoby, jmdodd, netweb
3
  Tags: forums, discussion, support, theme, akismet, multisite
4
  Requires at least: 4.7
5
  Tested up to: 4.7
6
- Stable tag: 2.5.13
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -40,6 +40,11 @@ We're keeping things as small and light as possible while still allowing for gre
40
 
41
  == Changelog ==
42
 
 
 
 
 
 
43
  = 2.5.13 =
44
  * Improved support for `post_parent__in` type queries
45
 
3
  Tags: forums, discussion, support, theme, akismet, multisite
4
  Requires at least: 4.7
5
  Tested up to: 4.7
6
+ Stable tag: 2.5.14
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
40
 
41
  == Changelog ==
42
 
43
+ = 2.5.14 =
44
+ * Improved support for PHP 7.1 and higher
45
+ * Improved pagination for non-public post statuses
46
+ * Fix converter row-limit boundaries
47
+
48
  = 2.5.13 =
49
  * Improved support for `post_parent__in` type queries
50