bbPress - Version 2.0.1

Version Description

  • Fix anonymous post editing bug
Download this release

Release Info

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

Code changes from version 2.0 to 2.0.1

bbp-admin/bbp-settings.php CHANGED
@@ -554,7 +554,7 @@ function bbp_form_option( $option, $default = '' , $slug = false ) {
554
  function bbp_form_slug_conflict_check( $slug, $default ) {
555
 
556
  // Only set the slugs once ver page load
557
- static $the_core_slugs;
558
 
559
  // Get the form value
560
  $this_slug = bbp_get_form_option( $slug, $default, true );
554
  function bbp_form_slug_conflict_check( $slug, $default ) {
555
 
556
  // Only set the slugs once ver page load
557
+ static $the_core_slugs = array();
558
 
559
  // Get the form value
560
  $this_slug = bbp_get_form_option( $slug, $default, true );
bbp-includes/bbp-common-functions.php CHANGED
@@ -1373,7 +1373,7 @@ function bbp_request_feed_trap( $query_vars ) {
1373
  'post_type' => bbp_get_reply_post_type(),
1374
  'post_parent' => 'any',
1375
  'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
1376
- 'posts_per_page' => get_option( '_bbp_replies_per_rss_page', 25 ),
1377
  'order' => 'DESC',
1378
  'meta_query' => $meta_query
1379
  );
@@ -1390,7 +1390,7 @@ function bbp_request_feed_trap( $query_vars ) {
1390
  'post_type' => bbp_get_topic_post_type(),
1391
  'post_parent' => 'any',
1392
  'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
1393
- 'posts_per_page' => get_option( '_bbp_topics_per_rss_page', 25 ),
1394
  'order' => 'DESC',
1395
  'meta_query' => $meta_query
1396
  );
@@ -1407,7 +1407,7 @@ function bbp_request_feed_trap( $query_vars ) {
1407
  'post_type' => array( bbp_get_reply_post_type(), bbp_get_topic_post_type() ),
1408
  'post_parent' => 'any',
1409
  'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
1410
- 'posts_per_page' => get_option( '_bbp_replies_per_rss_page', 25 ),
1411
  'order' => 'DESC',
1412
  'meta_query' => $meta_query
1413
  );
@@ -1440,7 +1440,7 @@ function bbp_request_feed_trap( $query_vars ) {
1440
  $the_query = array(
1441
  'author' => 0,
1442
  'post_parent' => 'any',
1443
- 'posts_per_page' => get_option( '_bbp_topics_per_rss_page', 25 ),
1444
  'show_stickies' => false,
1445
  );
1446
 
@@ -1455,7 +1455,7 @@ function bbp_request_feed_trap( $query_vars ) {
1455
 
1456
  // The query
1457
  $the_query = array(
1458
- 'posts_per_page' => get_option( '_bbp_replies_per_rss_page', 25 ),
1459
  'meta_query' => array( array( ) )
1460
  );
1461
 
1373
  'post_type' => bbp_get_reply_post_type(),
1374
  'post_parent' => 'any',
1375
  'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
1376
+ 'posts_per_page' => bbp_get_replies_per_rss_page(),
1377
  'order' => 'DESC',
1378
  'meta_query' => $meta_query
1379
  );
1390
  'post_type' => bbp_get_topic_post_type(),
1391
  'post_parent' => 'any',
1392
  'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
1393
+ 'posts_per_page' => bbp_get_topics_per_rss_page(),
1394
  'order' => 'DESC',
1395
  'meta_query' => $meta_query
1396
  );
1407
  'post_type' => array( bbp_get_reply_post_type(), bbp_get_topic_post_type() ),
1408
  'post_parent' => 'any',
1409
  'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
1410
+ 'posts_per_page' => bbp_get_replies_per_rss_page(),
1411
  'order' => 'DESC',
1412
  'meta_query' => $meta_query
1413
  );
1440
  $the_query = array(
1441
  'author' => 0,
1442
  'post_parent' => 'any',
1443
+ 'posts_per_page' => bbp_get_topics_per_rss_page(),
1444
  'show_stickies' => false,
1445
  );
1446
 
1455
 
1456
  // The query
1457
  $the_query = array(
1458
+ 'posts_per_page' => bbp_get_replies_per_rss_page(),
1459
  'meta_query' => array( array( ) )
1460
  );
1461
 
bbp-includes/bbp-common-template.php CHANGED
@@ -479,16 +479,25 @@ function bbp_is_single_user_edit() {
479
  *
480
  * @since bbPress (r2789)
481
  *
482
- * @uses WP_Query Checks if WP_Query::bbp_is_view is true
 
483
  * @return bool Is it a view page?
484
  */
485
  function bbp_is_single_view() {
486
  global $wp_query;
487
 
 
 
 
 
488
  if ( !empty( $wp_query->bbp_is_view ) && ( true == $wp_query->bbp_is_view ) )
489
- return true;
490
 
491
- return false;
 
 
 
 
492
  }
493
 
494
  /**
479
  *
480
  * @since bbPress (r2789)
481
  *
482
+ * @global WP_Query $wp_query To check if WP_Query::bbp_is_view is true
483
+ * @uses bbp_get_query_name() To get the query name
484
  * @return bool Is it a view page?
485
  */
486
  function bbp_is_single_view() {
487
  global $wp_query;
488
 
489
+ // Assume false
490
+ $retval = false;
491
+
492
+ // Check query
493
  if ( !empty( $wp_query->bbp_is_view ) && ( true == $wp_query->bbp_is_view ) )
494
+ $retval = true;
495
 
496
+ // Check query name
497
+ if ( empty( $retval ) && bbp_is_query_name( 'bbp_single_view' ) )
498
+ $retval = true;
499
+
500
+ return (bool) apply_filters( 'bbp_is_single_view', $retval );
501
  }
502
 
503
  /**
bbp-includes/bbp-core-compatibility.php CHANGED
@@ -1571,7 +1571,7 @@ function bbp_pre_get_posts( $posts_query ) {
1571
  if ( !empty( $is_edit ) ) {
1572
 
1573
  // Only allow super admins on multisite to edit every user.
1574
- if ( ( is_multisite() && !current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) {
1575
  wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) );
1576
  }
1577
 
@@ -1631,6 +1631,11 @@ function bbp_pre_get_posts( $posts_query ) {
1631
  // Topic/Reply Edit Page
1632
  } elseif ( !empty( $is_edit ) ) {
1633
 
 
 
 
 
 
1634
  // We are editing a topic
1635
  if ( $posts_query->get( 'post_type' ) == bbp_get_topic_post_type() ) {
1636
  $posts_query->bbp_is_topic_edit = true;
@@ -1671,9 +1676,9 @@ function bbp_pre_get_posts( $posts_query ) {
1671
 
1672
  // Topic tag page
1673
  } elseif ( bbp_is_topic_tag() ) {
1674
- $posts_query->set( 'bbp_topic_tag', get_query_var( 'term' ) );
1675
- $posts_query->set( 'post_type', bbp_get_topic_post_type() );
1676
- $posts_query->set( 'posts_per_page', get_option( '_bbp_topics_per_page', 15 ) );
1677
  }
1678
  }
1679
 
1571
  if ( !empty( $is_edit ) ) {
1572
 
1573
  // Only allow super admins on multisite to edit every user.
1574
+ if ( !is_user_logged_in() || ( is_multisite() && !current_user_can( 'manage_network_users' ) && ( $user->ID != bbp_get_current_user_id() ) && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) {
1575
  wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) );
1576
  }
1577
 
1631
  // Topic/Reply Edit Page
1632
  } elseif ( !empty( $is_edit ) ) {
1633
 
1634
+ // Bail from edit if user is not logged in
1635
+ if ( !is_user_logged_in() ) {
1636
+ return;
1637
+ }
1638
+
1639
  // We are editing a topic
1640
  if ( $posts_query->get( 'post_type' ) == bbp_get_topic_post_type() ) {
1641
  $posts_query->bbp_is_topic_edit = true;
1676
 
1677
  // Topic tag page
1678
  } elseif ( bbp_is_topic_tag() ) {
1679
+ $posts_query->set( 'bbp_topic_tag', get_query_var( 'term' ) );
1680
+ $posts_query->set( 'post_type', bbp_get_topic_post_type() );
1681
+ $posts_query->set( 'posts_per_page', bbp_get_topics_per_page() );
1682
  }
1683
  }
1684
 
bbp-includes/bbp-core-widgets.php CHANGED
@@ -100,7 +100,7 @@ class BBP_Login_Widget extends WP_Widget {
100
 
101
  <?php do_action( 'login_form' ); ?>
102
 
103
- <button type="submit" name="user-submit" id="user-submit" tabindex="<?php bbp_tab_index(); ?>" class="button submit user-submit">"<?php _e( 'Log In', 'bbpress' ); ?></button>
104
 
105
  <?php bbp_user_login_fields(); ?>
106
 
100
 
101
  <?php do_action( 'login_form' ); ?>
102
 
103
+ <button type="submit" name="user-submit" id="user-submit" tabindex="<?php bbp_tab_index(); ?>" class="button submit user-submit"><?php _e( 'Log In', 'bbpress' ); ?></button>
104
 
105
  <?php bbp_user_login_fields(); ?>
106
 
bbp-includes/bbp-extend-akismet.php CHANGED
@@ -575,7 +575,7 @@ class BBP_Akismet {
575
  * Submit data to Akismet service with unique bbPress User Agent
576
  *
577
  * This code is directly taken from the akismet_http_post() function and
578
- * documented to bbPress 2.0 standard.
579
  *
580
  * @since bbPress (r3466)
581
  *
575
  * Submit data to Akismet service with unique bbPress User Agent
576
  *
577
  * This code is directly taken from the akismet_http_post() function and
578
+ * documented to bbPress standard.
579
  *
580
  * @since bbPress (r3466)
581
  *
bbp-includes/bbp-forum-template.php CHANGED
@@ -1579,32 +1579,36 @@ function bbp_suppress_private_author_link( $author_link, $args ) {
1579
  *
1580
  * @since bbPress (r2667)
1581
  *
 
1582
  * @uses bbp_get_forum_class() To get the row class of the forum
1583
  */
1584
- function bbp_forum_class() {
1585
- echo bbp_get_forum_class();
1586
  }
1587
  /**
1588
  * Return the row class of a forum
1589
  *
1590
  * @since bbPress (r2667)
1591
  *
1592
- * @uses post_class() To get all the classes including ours
 
1593
  * @uses apply_filters() Calls 'bbp_get_forum_class' with the classes
1594
  * @return string Row class of the forum
1595
  */
1596
- function bbp_get_forum_class() {
1597
  global $bbp;
1598
 
 
 
1599
  $classes = array();
1600
- $classes[] = $bbp->forum_query->current_post % 2 ? 'even' : 'odd';
1601
- $classes[] = bbp_is_forum_category() ? 'status-category' : '';
1602
- $classes[] = bbp_is_forum_private() ? 'status-private' : '';
1603
  $classes = array_filter( $classes );
 
 
1604
 
1605
- $post = post_class( $classes );
1606
-
1607
- return apply_filters( 'bbp_get_forum_class', $post );
1608
  }
1609
 
1610
  /** Single Forum **************************************************************/
1579
  *
1580
  * @since bbPress (r2667)
1581
  *
1582
+ * @param int $forum_id Optional. Forum ID.
1583
  * @uses bbp_get_forum_class() To get the row class of the forum
1584
  */
1585
+ function bbp_forum_class( $forum_id = 0 ) {
1586
+ echo bbp_get_forum_class( $forum_id );
1587
  }
1588
  /**
1589
  * Return the row class of a forum
1590
  *
1591
  * @since bbPress (r2667)
1592
  *
1593
+ * @param int $forum_id Optional. Forum ID
1594
+ * @uses get_post_class() To get all the classes including ours
1595
  * @uses apply_filters() Calls 'bbp_get_forum_class' with the classes
1596
  * @return string Row class of the forum
1597
  */
1598
+ function bbp_get_forum_class( $forum_id = 0 ) {
1599
  global $bbp;
1600
 
1601
+ $forum_id = bbp_get_forum_id( $forum_id );
1602
+ $count = isset( $bbp->forum_query->current_post ) ? $bbp->forum_query->current_post : 1;
1603
  $classes = array();
1604
+ $classes[] = ( (int) $count % 2 ) ? 'even' : 'odd';
1605
+ $classes[] = bbp_is_forum_category( $forum_id ) ? 'status-category' : '';
1606
+ $classes[] = bbp_is_forum_private( $forum_id ) ? 'status-private' : '';
1607
  $classes = array_filter( $classes );
1608
+ $retval = get_post_class( $classes, $forum_id );
1609
+ $retval = 'class="' . join( ' ', $retval ) . '"';
1610
 
1611
+ return apply_filters( 'bbp_get_forum_class', $retval, $forum_id );
 
 
1612
  }
1613
 
1614
  /** Single Forum **************************************************************/
bbp-includes/bbp-reply-functions.php CHANGED
@@ -961,6 +961,7 @@ function bbp_toggle_reply_handler() {
961
  if ( !in_array( $_GET['action'], $possible_actions ) )
962
  return;
963
 
 
964
  $view_all = false; // Assume not viewing all
965
  $action = $_GET['action']; // What action is taking place?
966
  $reply_id = (int) $_GET['reply_id']; // What's the reply id?
@@ -968,7 +969,8 @@ function bbp_toggle_reply_handler() {
968
  $post_data = array( 'ID' => $reply_id ); // Prelim array
969
 
970
  // Make sure reply exists
971
- if ( !$reply = bbp_get_reply( $reply_id ) )
 
972
  return;
973
 
974
  // What is the user doing here?
@@ -1252,6 +1254,58 @@ function bbp_untrashed_reply( $reply_id = 0 ) {
1252
  do_action( 'bbp_untrashed_reply', $reply_id );
1253
  }
1254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1255
  /** Feeds *********************************************************************/
1256
 
1257
  /**
961
  if ( !in_array( $_GET['action'], $possible_actions ) )
962
  return;
963
 
964
+ $failure = ''; // Empty failure string
965
  $view_all = false; // Assume not viewing all
966
  $action = $_GET['action']; // What action is taking place?
967
  $reply_id = (int) $_GET['reply_id']; // What's the reply id?
969
  $post_data = array( 'ID' => $reply_id ); // Prelim array
970
 
971
  // Make sure reply exists
972
+ $reply = bbp_get_reply( $reply_id );
973
+ if ( empty( $reply ) )
974
  return;
975
 
976
  // What is the user doing here?
1254
  do_action( 'bbp_untrashed_reply', $reply_id );
1255
  }
1256
 
1257
+ /** Settings ******************************************************************/
1258
+
1259
+ /**
1260
+ * Return the replies per page setting
1261
+ *
1262
+ * @since bbPress (r3540)
1263
+ *
1264
+ * @uses get_option() To get the setting
1265
+ * @uses apply_filters() To allow the return value to be manipulated
1266
+ * @return int
1267
+ */
1268
+ function bbp_get_replies_per_page() {
1269
+
1270
+ // The default per setting
1271
+ $default = 15;
1272
+
1273
+ // Get database option and cast as integer
1274
+ $per = $retval = (int) get_option( '_bbp_replies_per_page', $default );
1275
+
1276
+ // If return val is empty, set it to default
1277
+ if ( empty( $retval ) )
1278
+ $retval = $default;
1279
+
1280
+ // Filter and return
1281
+ return (int) apply_filters( 'bbp_get_replies_per_page', $retval, $per );
1282
+ }
1283
+
1284
+ /**
1285
+ * Return the replies per RSS page setting
1286
+ *
1287
+ * @since bbPress (r3540)
1288
+ *
1289
+ * @uses get_option() To get the setting
1290
+ * @uses apply_filters() To allow the return value to be manipulated
1291
+ * @return int
1292
+ */
1293
+ function bbp_get_replies_per_rss_page() {
1294
+
1295
+ // The default per setting
1296
+ $default = 25;
1297
+
1298
+ // Get database option and cast as integer
1299
+ $per = $retval = (int) get_option( '_bbp_replies_per_rss_page', $default );
1300
+
1301
+ // If return val is empty, set it to default
1302
+ if ( empty( $retval ) )
1303
+ $retval = $default;
1304
+
1305
+ // Filter and return
1306
+ return (int) apply_filters( 'bbp_get_replies_per_rss_page', $retval, $per );
1307
+ }
1308
+
1309
  /** Feeds *********************************************************************/
1310
 
1311
  /**
bbp-includes/bbp-reply-template.php CHANGED
@@ -100,7 +100,7 @@ function bbp_has_replies( $args = '' ) {
100
  'order' => 'ASC',
101
 
102
  // Max number
103
- 'posts_per_page' => get_option( '_bbp_replies_per_page', 15 ),
104
 
105
  // Page Number
106
  'paged' => bbp_get_paged(),
@@ -377,7 +377,7 @@ function bbp_reply_url( $reply_id = 0 ) {
377
  $reply_position = bbp_get_reply_position ( $reply_id, $topic_id );
378
 
379
  // Check if in query with pagination
380
- $reply_page = ceil( $reply_position / get_option( '_bbp_replies_per_page', 15 ) );
381
 
382
  // Hash to add to end of URL
383
  $reply_hash = '#post-' . $reply_id;
@@ -1704,27 +1704,34 @@ function bbp_topic_split_link( $args = '' ) {
1704
  * Output the row class of a reply
1705
  *
1706
  * @since bbPress (r2678)
 
 
 
1707
  */
1708
- function bbp_reply_class() {
1709
- echo bbp_get_reply_class();
1710
  }
1711
  /**
1712
  * Return the row class of a reply
1713
  *
1714
  * @since bbPress (r2678)
1715
  *
1716
- * @uses post_class() To get all the classes including ours
 
1717
  * @uses apply_filters() Calls 'bbp_get_reply_class' with the classes
1718
  * @return string Row class of the reply
1719
  */
1720
- function bbp_get_reply_class() {
1721
  global $bbp;
1722
 
 
1723
  $count = isset( $bbp->reply_query->current_post ) ? $bbp->reply_query->current_post : 1;
1724
- $alternate = (int) $count % 2 ? 'even' : 'odd';
1725
- $post = post_class( array( $alternate ) );
 
 
1726
 
1727
- return apply_filters( 'bbp_reply_class', $post );
1728
  }
1729
 
1730
  /**
100
  'order' => 'ASC',
101
 
102
  // Max number
103
+ 'posts_per_page' => bbp_get_replies_per_page(),
104
 
105
  // Page Number
106
  'paged' => bbp_get_paged(),
377
  $reply_position = bbp_get_reply_position ( $reply_id, $topic_id );
378
 
379
  // Check if in query with pagination
380
+ $reply_page = ceil( (int) $reply_position / (int) bbp_get_replies_per_page() );
381
 
382
  // Hash to add to end of URL
383
  $reply_hash = '#post-' . $reply_id;
1704
  * Output the row class of a reply
1705
  *
1706
  * @since bbPress (r2678)
1707
+ *
1708
+ * @param int $reply_id Optional. Reply ID
1709
+ * @uses bbp_get_reply_class() To get the reply class
1710
  */
1711
+ function bbp_reply_class( $reply_id = 0 ) {
1712
+ echo bbp_get_reply_class( $reply_id );
1713
  }
1714
  /**
1715
  * Return the row class of a reply
1716
  *
1717
  * @since bbPress (r2678)
1718
  *
1719
+ * @param int $reply_id Optional. Reply ID
1720
+ * @uses get_post_class() To get all the classes including ours
1721
  * @uses apply_filters() Calls 'bbp_get_reply_class' with the classes
1722
  * @return string Row class of the reply
1723
  */
1724
+ function bbp_get_reply_class( $reply_id = 0 ) {
1725
  global $bbp;
1726
 
1727
+ $reply_id = bbp_get_reply_id( $reply_id );
1728
  $count = isset( $bbp->reply_query->current_post ) ? $bbp->reply_query->current_post : 1;
1729
+ $classes = array();
1730
+ $classes[] = ( (int) $count % 2 ) ? 'even' : 'odd';
1731
+ $retval = get_post_class( $classes, $reply_id );
1732
+ $retval = 'class="' . join( ' ', $retval ) . '"';
1733
 
1734
+ return apply_filters( 'bbp_get_reply_class', $retval, $reply_id );
1735
  }
1736
 
1737
  /**
bbp-includes/bbp-topic-functions.php CHANGED
@@ -791,7 +791,10 @@ function bbp_update_topic( $topic_id = 0, $forum_id = 0, $anonymous_data = false
791
  function bbp_update_topic_walker( $topic_id, $last_active_time = '', $forum_id = 0, $reply_id = 0, $refresh = true ) {
792
 
793
  // Validate topic_id
794
- $topic_id = bbp_get_topic_id( $topic_id );
 
 
 
795
 
796
  // Topic was passed
797
  if ( !empty( $topic_id ) ) {
@@ -880,7 +883,7 @@ function bbp_move_topic_handler( $topic_id, $old_forum_id, $new_forum_id ) {
880
 
881
  // Add non-matches to the updated array
882
  if ( $topic_id != $sticky_topic_id ) {
883
- $updated_stickies[$k] = $v;
884
  }
885
  }
886
 
@@ -1824,14 +1827,17 @@ function bbp_toggle_topic_handler() {
1824
  if ( !in_array( $_GET['action'], $possible_actions ) )
1825
  return;
1826
 
 
1827
  $view_all = false; // Assume not viewing all
1828
  $action = $_GET['action']; // What action is taking place?
1829
  $topic_id = (int) $_GET['topic_id']; // What's the topic id?
1830
  $success = false; // Flag
1831
  $post_data = array( 'ID' => $topic_id ); // Prelim array
 
1832
 
1833
  // Make sure topic exists
1834
- if ( !$topic = bbp_get_topic( $topic_id ) )
 
1835
  return;
1836
 
1837
  // What is the user doing here?
@@ -2500,6 +2506,9 @@ function bbp_spam_topic( $topic_id = 0 ) {
2500
  // Get topic tags
2501
  $terms = get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() );
2502
 
 
 
 
2503
  // Topic has tags
2504
  if ( !empty( $terms ) ) {
2505
 
@@ -2877,6 +2886,58 @@ function bbp_untrashed_topic( $topic_id = 0 ) {
2877
  do_action( 'bbp_untrashed_topic', $topic_id );
2878
  }
2879
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2880
  /** Feeds *********************************************************************/
2881
 
2882
  /**
791
  function bbp_update_topic_walker( $topic_id, $last_active_time = '', $forum_id = 0, $reply_id = 0, $refresh = true ) {
792
 
793
  // Validate topic_id
794
+ $topic_id = bbp_get_topic_id( $topic_id );
795
+
796
+ // Define local variable(s)
797
+ $active_id = 0;
798
 
799
  // Topic was passed
800
  if ( !empty( $topic_id ) ) {
883
 
884
  // Add non-matches to the updated array
885
  if ( $topic_id != $sticky_topic_id ) {
886
+ $updated_stickies[] = $sticky_topic_id;
887
  }
888
  }
889
 
1827
  if ( !in_array( $_GET['action'], $possible_actions ) )
1828
  return;
1829
 
1830
+ $failure = ''; // Empty failure string
1831
  $view_all = false; // Assume not viewing all
1832
  $action = $_GET['action']; // What action is taking place?
1833
  $topic_id = (int) $_GET['topic_id']; // What's the topic id?
1834
  $success = false; // Flag
1835
  $post_data = array( 'ID' => $topic_id ); // Prelim array
1836
+ $redirect = ''; // Empty redirect URL
1837
 
1838
  // Make sure topic exists
1839
+ $topic = bbp_get_topic( $topic_id );
1840
+ if ( empty( $topic ) )
1841
  return;
1842
 
1843
  // What is the user doing here?
2506
  // Get topic tags
2507
  $terms = get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() );
2508
 
2509
+ // Define local variable(s)
2510
+ $term_names = array();
2511
+
2512
  // Topic has tags
2513
  if ( !empty( $terms ) ) {
2514
 
2886
  do_action( 'bbp_untrashed_topic', $topic_id );
2887
  }
2888
 
2889
+ /** Settings ******************************************************************/
2890
+
2891
+ /**
2892
+ * Return the topics per page setting
2893
+ *
2894
+ * @since bbPress (r3540)
2895
+ *
2896
+ * @uses get_option() To get the setting
2897
+ * @uses apply_filters() To allow the return value to be manipulated
2898
+ * @return int
2899
+ */
2900
+ function bbp_get_topics_per_page() {
2901
+
2902
+ // The default per setting
2903
+ $default = 15;
2904
+
2905
+ // Get database option and cast as integer
2906
+ $per = $retval = (int) get_option( '_bbp_topics_per_page', $default );
2907
+
2908
+ // If return val is empty, set it to default
2909
+ if ( empty( $retval ) )
2910
+ $retval = $default;
2911
+
2912
+ // Filter and return
2913
+ return (int) apply_filters( 'bbp_get_topics_per_page', $retval, $per );
2914
+ }
2915
+
2916
+ /**
2917
+ * Return the topics per RSS page setting
2918
+ *
2919
+ * @since bbPress (r3540)
2920
+ *
2921
+ * @uses get_option() To get the setting
2922
+ * @uses apply_filters() To allow the return value to be manipulated
2923
+ * @return int
2924
+ */
2925
+ function bbp_get_topics_per_rss_page() {
2926
+
2927
+ // The default per setting
2928
+ $default = 25;
2929
+
2930
+ // Get database option and cast as integer
2931
+ $per = $retval = (int) get_option( '_bbp_topics_per_rss_page', $default );
2932
+
2933
+ // If return val is empty, set it to default
2934
+ if ( empty( $retval ) )
2935
+ $retval = $default;
2936
+
2937
+ // Filter and return
2938
+ return (int) apply_filters( 'bbp_get_topics_per_rss_page', $retval, $per );
2939
+ }
2940
+
2941
  /** Feeds *********************************************************************/
2942
 
2943
  /**
bbp-includes/bbp-topic-template.php CHANGED
@@ -93,7 +93,7 @@ function bbp_has_topics( $args = '' ) {
93
  'order' => 'DESC',
94
 
95
  // Topics per page
96
- 'posts_per_page' => get_option( '_bbp_topics_per_page', 15 ),
97
 
98
  // Page Number
99
  'paged' => bbp_get_paged(),
@@ -678,7 +678,7 @@ function bbp_topic_pagination( $args = '' ) {
678
  $pagination = array(
679
  'base' => $base,
680
  'format' => '',
681
- 'total' => ceil( (int) $total / (int) get_option( '_bbp_replies_per_page', 15 ) ),
682
  'current' => 0,
683
  'prev_next' => false,
684
  'mid_size' => 2,
@@ -1923,7 +1923,7 @@ function bbp_topic_class( $topic_id = 0 ) {
1923
  * @uses bbp_is_topic_sticky() To check if the topic is a sticky
1924
  * @uses bbp_is_topic_super_sticky() To check if the topic is a super
1925
  * sticky
1926
- * @uses post_class() To get the topic classes
1927
  * @uses apply_filters() Calls 'bbp_get_topic_class' with the classes
1928
  * and topic id
1929
  * @return string Row class of a topic
@@ -1931,14 +1931,17 @@ function bbp_topic_class( $topic_id = 0 ) {
1931
  function bbp_get_topic_class( $topic_id = 0 ) {
1932
  global $bbp;
1933
 
 
 
1934
  $classes = array();
1935
- $classes[] = $bbp->topic_query->current_post % 2 ? 'even' : 'odd';
1936
  $classes[] = bbp_is_topic_sticky( $topic_id, false ) ? 'sticky' : '';
1937
  $classes[] = bbp_is_topic_super_sticky( $topic_id ) ? 'super-sticky' : '';
1938
  $classes = array_filter( $classes );
1939
- $post = post_class( $classes, $topic_id );
 
1940
 
1941
- return apply_filters( 'bbp_get_topic_class', $post, $topic_id );
1942
  }
1943
 
1944
  /** Topic Admin Links *********************************************************/
93
  'order' => 'DESC',
94
 
95
  // Topics per page
96
+ 'posts_per_page' => bbp_get_topics_per_page(),
97
 
98
  // Page Number
99
  'paged' => bbp_get_paged(),
678
  $pagination = array(
679
  'base' => $base,
680
  'format' => '',
681
+ 'total' => ceil( (int) $total / (int) bbp_get_replies_per_page() ),
682
  'current' => 0,
683
  'prev_next' => false,
684
  'mid_size' => 2,
1923
  * @uses bbp_is_topic_sticky() To check if the topic is a sticky
1924
  * @uses bbp_is_topic_super_sticky() To check if the topic is a super
1925
  * sticky
1926
+ * @uses get_post_class() To get the topic classes
1927
  * @uses apply_filters() Calls 'bbp_get_topic_class' with the classes
1928
  * and topic id
1929
  * @return string Row class of a topic
1931
  function bbp_get_topic_class( $topic_id = 0 ) {
1932
  global $bbp;
1933
 
1934
+ $topic_id = bbp_get_topic_id( $topic_id );
1935
+ $count = isset( $bbp->topic_query->current_post ) ? $bbp->topic_query->current_post : 1;
1936
  $classes = array();
1937
+ $classes[] = ( (int) $count % 2 ) ? 'even' : 'odd';
1938
  $classes[] = bbp_is_topic_sticky( $topic_id, false ) ? 'sticky' : '';
1939
  $classes[] = bbp_is_topic_super_sticky( $topic_id ) ? 'super-sticky' : '';
1940
  $classes = array_filter( $classes );
1941
+ $retval = get_post_class( $classes, $topic_id );
1942
+ $retval = 'class="' . join( ' ', $retval ) . '"';
1943
 
1944
+ return apply_filters( 'bbp_get_topic_class', $retval, $topic_id );
1945
  }
1946
 
1947
  /** Topic Admin Links *********************************************************/
bbpress.php CHANGED
@@ -15,7 +15,7 @@
15
  * Description: bbPress is forum software with a twist from the creators of WordPress.
16
  * Author: The bbPress Community
17
  * Author URI: http://bbpress.org
18
- * Version: 2.0
19
  * Text Domain: bbpress
20
  * Domain Path: /bbp-languages/
21
  */
@@ -48,7 +48,7 @@ class bbPress {
48
  /**
49
  * @public string bbPress version
50
  */
51
- public $version = '2.0';
52
 
53
  /**
54
  * @public string bbPress DB version
15
  * Description: bbPress is forum software with a twist from the creators of WordPress.
16
  * Author: The bbPress Community
17
  * Author URI: http://bbpress.org
18
+ * Version: 2.0.1
19
  * Text Domain: bbpress
20
  * Domain Path: /bbp-languages/
21
  */
48
  /**
49
  * @public string bbPress version
50
  */
51
+ public $version = '2.0.1';
52
 
53
  /**
54
  * @public string bbPress DB version
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: matt, johnjamesjacoby
3
  Tags: bbpress, forums, discussion, support, theme, buddypress, akismet, multisite
4
  Requires at least: 3.2.1
5
  Tested up to: 3.2.1
6
- Stable tag: 2.0
7
 
8
  bbPress is forum software with a twist from the creators of WordPress
9
 
@@ -22,17 +22,11 @@ We're keeping things as small and light as possible while still allowing for gre
22
  5. View your site.
23
  6. Adjust the CSS of your theme as needed, to make everything pretty.
24
 
25
- == Screenshots ==
26
- 1. Forums - Admin Interface
27
- 2. Topics - Admin Interface
28
- 3. Replies - Admin Interface
29
- 4. Settings 1 - Admin Interface
30
- 5. Settings 2 - Admin Interface
31
- 6. Themes - Admin Interface
32
- 7. Single Forum - Default Theme
33
-
34
  == Changelog ==
35
 
 
 
 
36
  = 2.0 =
37
  * Released on September 21, 2011
38
 
3
  Tags: bbpress, forums, discussion, support, theme, buddypress, akismet, multisite
4
  Requires at least: 3.2.1
5
  Tested up to: 3.2.1
6
+ Stable tag: 2.0.1
7
 
8
  bbPress is forum software with a twist from the creators of WordPress
9
 
22
  5. View your site.
23
  6. Adjust the CSS of your theme as needed, to make everything pretty.
24
 
 
 
 
 
 
 
 
 
 
25
  == Changelog ==
26
 
27
+ = 2.0.1 =
28
+ * Fix anonymous post editing bug
29
+
30
  = 2.0 =
31
  * Released on September 21, 2011
32
 
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
screenshot-6.png DELETED
Binary file
screenshot-7.png DELETED
Binary file