bbPress - Version 2.4.1

Version Description

  • Fix forum status saving
  • Fix widget settings saving
  • Fix custom wp_title compatibility
  • Fix search results custom permalink compatibility
  • Fix custom user topics & replies pages
  • Fix hierarchical reply handling in converter
Download this release

Release Info

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

Code changes from version 2.4 to 2.4.1

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 5096 2013-09-02 17:42:26Z 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: http://bbpress.org
20
- * Version: 2.4
21
  * Text Domain: bbpress
22
  * Domain Path: /languages/
23
  */
@@ -190,7 +190,7 @@ final class bbPress {
190
 
191
  /** Versions **********************************************************/
192
 
193
- $this->version = '2.4';
194
  $this->db_version = '240';
195
 
196
  /** Paths *************************************************************/
5
  *
6
  * bbPress is forum software with a twist from the creators of WordPress.
7
  *
8
+ * $Id: bbpress.php 5127 2013-10-10 23:11:01Z 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: http://bbpress.org
20
+ * Version: 2.4.1
21
  * Text Domain: bbpress
22
  * Domain Path: /languages/
23
  */
190
 
191
  /** Versions **********************************************************/
192
 
193
+ $this->version = '2.4.1';
194
  $this->db_version = '240';
195
 
196
  /** Paths *************************************************************/
includes/admin/converter.php CHANGED
@@ -1002,7 +1002,7 @@ abstract class BBP_Converter_Base {
1002
  }
1003
 
1004
  /**
1005
- * This method conerts old forum heirarchy to new bbPress heirarchy.
1006
  */
1007
  public function convert_forum_parents( $start ) {
1008
 
@@ -1028,7 +1028,7 @@ abstract class BBP_Converter_Base {
1028
  }
1029
 
1030
  /**
1031
- * This method conerts old reply_to post id to new bbPress reply_to post id.
1032
  */
1033
  public function convert_reply_to_parents( $start ) {
1034
 
@@ -1248,9 +1248,9 @@ abstract class BBP_Converter_Base {
1248
  private function callback_reply_to( $field ) {
1249
  if ( !isset( $this->map_reply_to[$field] ) ) {
1250
  if ( !empty( $this->sync_table ) ) {
1251
- $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_reply_to" AND meta_value = "%s" LIMIT 1', $field ) );
1252
  } else {
1253
- $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_reply_to" AND meta_value = "%s" LIMIT 1', $field ) );
1254
  }
1255
 
1256
  if ( !is_null( $row ) ) {
1002
  }
1003
 
1004
  /**
1005
+ * This method converts old forum heirarchy to new bbPress heirarchy.
1006
  */
1007
  public function convert_forum_parents( $start ) {
1008
 
1028
  }
1029
 
1030
  /**
1031
+ * This method converts old reply_to post id to new bbPress reply_to post id.
1032
  */
1033
  public function convert_reply_to_parents( $start ) {
1034
 
1248
  private function callback_reply_to( $field ) {
1249
  if ( !isset( $this->map_reply_to[$field] ) ) {
1250
  if ( !empty( $this->sync_table ) ) {
1251
+ $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_post_id" AND meta_value = "%s" LIMIT 1', $field ) );
1252
  } else {
1253
+ $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_post_id" AND meta_value = "%s" LIMIT 1', $field ) );
1254
  }
1255
 
1256
  if ( !is_null( $row ) ) {
includes/common/functions.php CHANGED
@@ -1531,160 +1531,185 @@ function bbp_request_feed_trap( $query_vars = array() ) {
1531
 
1532
  // Forum/Topic/Reply Feed
1533
  if ( isset( $query_vars['post_type'] ) ) {
1534
-
1535
- // Supported select query vars
1536
- $select_query_vars = array(
1537
- 'p' => false,
1538
- 'name' => false,
1539
- $query_vars['post_type'] => false
1540
- );
1541
-
1542
- // Setup matched variables to select
1543
- foreach ( $query_vars as $key => $value ) {
1544
- if ( isset( $select_query_vars[$key] ) ) {
1545
- $select_query_vars[$key] = $value;
1546
- }
1547
- }
1548
 
1549
- // Remove any empties
1550
- $select_query_vars = array_filter( $select_query_vars );
1551
 
1552
- // What bbPress post type are we looking for feeds on?
1553
- switch ( $query_vars['post_type'] ) {
 
 
 
 
1554
 
1555
- // Forum
1556
- case bbp_get_forum_post_type() :
1557
 
1558
- // Define local variable(s)
1559
- $meta_query = array();
 
 
 
 
 
1560
 
1561
- // Single forum
1562
- if ( !empty( $select_query_vars ) ) {
1563
 
1564
- // Load up our own query
1565
- query_posts( array_merge( array(
1566
- 'post_type' => bbp_get_forum_post_type(),
1567
- 'feed' => true
1568
- ), $select_query_vars ) );
 
1569
 
1570
- // Restrict to specific forum ID
1571
- $meta_query = array( array(
1572
- 'key' => '_bbp_forum_id',
1573
- 'value' => bbp_get_forum_id(),
1574
- 'type' => 'numeric',
1575
- 'compare' => '='
1576
- ) );
1577
  }
 
1578
 
1579
- // Only forum replies
1580
- if ( !empty( $_GET['type'] ) && ( bbp_get_reply_post_type() === $_GET['type'] ) ) {
1581
-
1582
- // The query
1583
- $the_query = array(
1584
- 'author' => 0,
1585
- 'feed' => true,
1586
- 'post_type' => bbp_get_reply_post_type(),
1587
- 'post_parent' => 'any',
1588
- 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
1589
- 'posts_per_page' => bbp_get_replies_per_rss_page(),
1590
- 'order' => 'DESC',
1591
- 'meta_query' => $meta_query
1592
- );
1593
-
1594
- // Output the feed
1595
- bbp_display_replies_feed_rss2( $the_query );
1596
-
1597
- // Only forum topics
1598
- } elseif ( !empty( $_GET['type'] ) && ( bbp_get_topic_post_type() === $_GET['type'] ) ) {
1599
-
1600
- // The query
1601
- $the_query = array(
1602
- 'author' => 0,
1603
- 'feed' => true,
1604
- 'post_type' => bbp_get_topic_post_type(),
1605
- 'post_parent' => bbp_get_forum_id(),
1606
- 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
1607
- 'posts_per_page' => bbp_get_topics_per_rss_page(),
1608
- 'order' => 'DESC'
1609
- );
1610
-
1611
- // Output the feed
1612
- bbp_display_topics_feed_rss2( $the_query );
1613
-
1614
- // All forum topics and replies
1615
- } else {
1616
-
1617
- // Exclude private/hidden forums if not looking at single
1618
- if ( empty( $select_query_vars ) )
1619
- $meta_query = array( bbp_exclude_forum_ids( 'meta_query' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1620
 
1621
  // The query
1622
  $the_query = array(
1623
- 'author' => 0,
1624
- 'feed' => true,
1625
- 'post_type' => array( bbp_get_reply_post_type(), bbp_get_topic_post_type() ),
1626
- 'post_parent' => 'any',
1627
- 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
1628
  'posts_per_page' => bbp_get_replies_per_rss_page(),
1629
- 'order' => 'DESC',
1630
- 'meta_query' => $meta_query
1631
  );
1632
 
1633
- // Output the feed
1634
- bbp_display_replies_feed_rss2( $the_query );
1635
- }
 
1636
 
1637
- break;
1638
-
1639
- // Topic feed - Show replies
1640
- case bbp_get_topic_post_type() :
1641
-
1642
- // Single topic
1643
- if ( !empty( $select_query_vars ) ) {
1644
-
1645
- // Load up our own query
1646
- query_posts( array_merge( array(
1647
- 'post_type' => bbp_get_topic_post_type(),
1648
- 'feed' => true
1649
- ), $select_query_vars ) );
1650
-
1651
- // Output the feed
1652
- bbp_display_replies_feed_rss2( array( 'feed' => true ) );
1653
-
1654
- // All topics
1655
- } else {
1656
-
1657
- // The query
1658
- $the_query = array(
1659
- 'author' => 0,
1660
- 'feed' => true,
1661
- 'post_parent' => 'any',
1662
- 'posts_per_page' => bbp_get_topics_per_rss_page(),
1663
- 'show_stickies' => false
1664
- );
1665
-
1666
- // Output the feed
1667
- bbp_display_topics_feed_rss2( $the_query );
1668
- }
1669
-
1670
- break;
1671
-
1672
- // Replies
1673
- case bbp_get_reply_post_type() :
1674
-
1675
- // The query
1676
- $the_query = array(
1677
- 'posts_per_page' => bbp_get_replies_per_rss_page(),
1678
- 'meta_query' => array( array( ) ),
1679
- 'feed' => true
1680
- );
1681
-
1682
- // All replies
1683
- if ( empty( $select_query_vars ) ) {
1684
- bbp_display_replies_feed_rss2( $the_query );
1685
- }
1686
-
1687
- break;
1688
  }
1689
 
1690
  // Single Topic Vview
1531
 
1532
  // Forum/Topic/Reply Feed
1533
  if ( isset( $query_vars['post_type'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1534
 
1535
+ // Matched post type
1536
+ $post_type = false;
1537
 
1538
+ // Post types to check
1539
+ $post_types = array(
1540
+ bbp_get_forum_post_type(),
1541
+ bbp_get_topic_post_type(),
1542
+ bbp_get_reply_post_type()
1543
+ );
1544
 
1545
+ // Cast query vars as array outside of foreach loop
1546
+ $qv_array = (array) $query_vars['post_type'];
1547
 
1548
+ // Check if this query is for a bbPress post type
1549
+ foreach ( $post_types as $bbp_pt ) {
1550
+ if ( in_array( $bbp_pt, $qv_array, true ) ) {
1551
+ $post_type = $bbp_pt;
1552
+ break;
1553
+ }
1554
+ }
1555
 
1556
+ // Looking at a bbPress post type
1557
+ if ( ! empty( $post_type ) ) {
1558
 
1559
+ // Supported select query vars
1560
+ $select_query_vars = array(
1561
+ 'p' => false,
1562
+ 'name' => false,
1563
+ $post_type => false,
1564
+ );
1565
 
1566
+ // Setup matched variables to select
1567
+ foreach ( $query_vars as $key => $value ) {
1568
+ if ( isset( $select_query_vars[$key] ) ) {
1569
+ $select_query_vars[$key] = $value;
 
 
 
1570
  }
1571
+ }
1572
 
1573
+ // Remove any empties
1574
+ $select_query_vars = array_filter( $select_query_vars );
1575
+
1576
+ // What bbPress post type are we looking for feeds on?
1577
+ switch ( $post_type ) {
1578
+
1579
+ // Forum
1580
+ case bbp_get_forum_post_type() :
1581
+
1582
+ // Define local variable(s)
1583
+ $meta_query = array();
1584
+
1585
+ // Single forum
1586
+ if ( !empty( $select_query_vars ) ) {
1587
+
1588
+ // Load up our own query
1589
+ query_posts( array_merge( array(
1590
+ 'post_type' => bbp_get_forum_post_type(),
1591
+ 'feed' => true
1592
+ ), $select_query_vars ) );
1593
+
1594
+ // Restrict to specific forum ID
1595
+ $meta_query = array( array(
1596
+ 'key' => '_bbp_forum_id',
1597
+ 'value' => bbp_get_forum_id(),
1598
+ 'type' => 'numeric',
1599
+ 'compare' => '='
1600
+ ) );
1601
+ }
1602
+
1603
+ // Only forum replies
1604
+ if ( !empty( $_GET['type'] ) && ( bbp_get_reply_post_type() === $_GET['type'] ) ) {
1605
+
1606
+ // The query
1607
+ $the_query = array(
1608
+ 'author' => 0,
1609
+ 'feed' => true,
1610
+ 'post_type' => bbp_get_reply_post_type(),
1611
+ 'post_parent' => 'any',
1612
+ 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
1613
+ 'posts_per_page' => bbp_get_replies_per_rss_page(),
1614
+ 'order' => 'DESC',
1615
+ 'meta_query' => $meta_query
1616
+ );
1617
+
1618
+ // Output the feed
1619
+ bbp_display_replies_feed_rss2( $the_query );
1620
+
1621
+ // Only forum topics
1622
+ } elseif ( !empty( $_GET['type'] ) && ( bbp_get_topic_post_type() === $_GET['type'] ) ) {
1623
+
1624
+ // The query
1625
+ $the_query = array(
1626
+ 'author' => 0,
1627
+ 'feed' => true,
1628
+ 'post_type' => bbp_get_topic_post_type(),
1629
+ 'post_parent' => bbp_get_forum_id(),
1630
+ 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
1631
+ 'posts_per_page' => bbp_get_topics_per_rss_page(),
1632
+ 'order' => 'DESC'
1633
+ );
1634
+
1635
+ // Output the feed
1636
+ bbp_display_topics_feed_rss2( $the_query );
1637
+
1638
+ // All forum topics and replies
1639
+ } else {
1640
+
1641
+ // Exclude private/hidden forums if not looking at single
1642
+ if ( empty( $select_query_vars ) )
1643
+ $meta_query = array( bbp_exclude_forum_ids( 'meta_query' ) );
1644
+
1645
+ // The query
1646
+ $the_query = array(
1647
+ 'author' => 0,
1648
+ 'feed' => true,
1649
+ 'post_type' => array( bbp_get_reply_post_type(), bbp_get_topic_post_type() ),
1650
+ 'post_parent' => 'any',
1651
+ 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
1652
+ 'posts_per_page' => bbp_get_replies_per_rss_page(),
1653
+ 'order' => 'DESC',
1654
+ 'meta_query' => $meta_query
1655
+ );
1656
+
1657
+ // Output the feed
1658
+ bbp_display_replies_feed_rss2( $the_query );
1659
+ }
1660
+
1661
+ break;
1662
+
1663
+ // Topic feed - Show replies
1664
+ case bbp_get_topic_post_type() :
1665
+
1666
+ // Single topic
1667
+ if ( !empty( $select_query_vars ) ) {
1668
+
1669
+ // Load up our own query
1670
+ query_posts( array_merge( array(
1671
+ 'post_type' => bbp_get_topic_post_type(),
1672
+ 'feed' => true
1673
+ ), $select_query_vars ) );
1674
+
1675
+ // Output the feed
1676
+ bbp_display_replies_feed_rss2( array( 'feed' => true ) );
1677
+
1678
+ // All topics
1679
+ } else {
1680
+
1681
+ // The query
1682
+ $the_query = array(
1683
+ 'author' => 0,
1684
+ 'feed' => true,
1685
+ 'post_parent' => 'any',
1686
+ 'posts_per_page' => bbp_get_topics_per_rss_page(),
1687
+ 'show_stickies' => false
1688
+ );
1689
+
1690
+ // Output the feed
1691
+ bbp_display_topics_feed_rss2( $the_query );
1692
+ }
1693
+
1694
+ break;
1695
+
1696
+ // Replies
1697
+ case bbp_get_reply_post_type() :
1698
 
1699
  // The query
1700
  $the_query = array(
 
 
 
 
 
1701
  'posts_per_page' => bbp_get_replies_per_rss_page(),
1702
+ 'meta_query' => array( array( ) ),
1703
+ 'feed' => true
1704
  );
1705
 
1706
+ // All replies
1707
+ if ( empty( $select_query_vars ) ) {
1708
+ bbp_display_replies_feed_rss2( $the_query );
1709
+ }
1710
 
1711
+ break;
1712
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1713
  }
1714
 
1715
  // Single Topic Vview
includes/common/template.php CHANGED
@@ -2501,64 +2501,61 @@ function bbp_logout_link( $redirect_to = '' ) {
2501
  */
2502
  function bbp_title( $title = '', $sep = '»', $seplocation = '' ) {
2503
 
2504
- // Store original title to compare
2505
- $_title = $title;
2506
-
2507
  // Title array
2508
- $title = array();
2509
 
2510
  /** Archives **************************************************************/
2511
 
2512
  // Forum Archive
2513
  if ( bbp_is_forum_archive() ) {
2514
- $title['text'] = bbp_get_forum_archive_title();
2515
 
2516
  // Topic Archive
2517
  } elseif ( bbp_is_topic_archive() ) {
2518
- $title['text'] = bbp_get_topic_archive_title();
2519
 
2520
  /** Edit ******************************************************************/
2521
 
2522
  // Forum edit page
2523
  } elseif ( bbp_is_forum_edit() ) {
2524
- $title['text'] = bbp_get_forum_title();
2525
- $title['format'] = esc_attr__( 'Forum Edit: %s', 'bbpress' );
2526
 
2527
  // Topic edit page
2528
  } elseif ( bbp_is_topic_edit() ) {
2529
- $title['text'] = bbp_get_topic_title();
2530
- $title['format'] = esc_attr__( 'Topic Edit: %s', 'bbpress' );
2531
 
2532
  // Reply edit page
2533
  } elseif ( bbp_is_reply_edit() ) {
2534
- $title['text'] = bbp_get_reply_title();
2535
- $title['format'] = esc_attr__( 'Reply Edit: %s', 'bbpress' );
2536
 
2537
  // Topic tag edit page
2538
  } elseif ( bbp_is_topic_tag_edit() ) {
2539
- $title['text'] = bbp_get_topic_tag_name();
2540
- $title['format'] = esc_attr__( 'Topic Tag Edit: %s', 'bbpress' );
2541
 
2542
  /** Singles ***************************************************************/
2543
 
2544
  // Forum page
2545
  } elseif ( bbp_is_single_forum() ) {
2546
- $title['text'] = bbp_get_forum_title();
2547
- $title['format'] = esc_attr__( 'Forum: %s', 'bbpress' );
2548
 
2549
  // Topic page
2550
  } elseif ( bbp_is_single_topic() ) {
2551
- $title['text'] = bbp_get_topic_title();
2552
- $title['format'] = esc_attr__( 'Topic: %s', 'bbpress' );
2553
 
2554
  // Replies
2555
  } elseif ( bbp_is_single_reply() ) {
2556
- $title['text'] = bbp_get_reply_title();
2557
 
2558
  // Topic tag page
2559
  } elseif ( bbp_is_topic_tag() || get_query_var( 'bbp_topic_tag' ) ) {
2560
- $title['text'] = bbp_get_topic_tag_name();
2561
- $title['format'] = esc_attr__( 'Topic Tag: %s', 'bbpress' );
2562
 
2563
  /** Users *****************************************************************/
2564
 
@@ -2567,12 +2564,12 @@ function bbp_title( $title = '', $sep = '»', $seplocation = '' ) {
2567
 
2568
  // Current users profile
2569
  if ( bbp_is_user_home() ) {
2570
- $title['text'] = esc_attr__( 'Your Profile', 'bbpress' );
2571
 
2572
  // Other users profile
2573
  } else {
2574
- $title['text'] = get_userdata( bbp_get_user_id() )->display_name;
2575
- $title['format'] = esc_attr__( "%s's Profile", 'bbpress' );
2576
  }
2577
 
2578
  // Profile edit page
@@ -2580,65 +2577,65 @@ function bbp_title( $title = '', $sep = '»', $seplocation = '' ) {
2580
 
2581
  // Current users profile
2582
  if ( bbp_is_user_home_edit() ) {
2583
- $title['text'] = esc_attr__( 'Edit Your Profile', 'bbpress' );
2584
 
2585
  // Other users profile
2586
  } else {
2587
- $title['text'] = get_userdata( bbp_get_user_id() )->display_name;
2588
- $title['format'] = esc_attr__( "Edit %s's Profile", 'bbpress' );
2589
  }
2590
 
2591
  /** Views *****************************************************************/
2592
 
2593
  // Views
2594
  } elseif ( bbp_is_single_view() ) {
2595
- $title['text'] = bbp_get_view_title();
2596
- $title['format'] = esc_attr__( 'View: %s', 'bbpress' );
2597
 
2598
  /** Search ****************************************************************/
2599
 
2600
  // Search
2601
  } elseif ( bbp_is_search() ) {
2602
- $title['text'] = bbp_get_search_title();
2603
  }
2604
 
2605
  // This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
2606
- $title = apply_filters( 'bbp_raw_title_array', $title );
2607
 
2608
  // Set title array defaults
2609
- $title = bbp_parse_args( $title, array(
2610
- 'text' => '',
2611
  'format' => '%s'
2612
  ), 'title' );
2613
 
2614
  // Get the formatted raw title
2615
- $title = sprintf( $title['format'], $title['text'] );
2616
 
2617
  // Filter the raw title
2618
- $title = apply_filters( 'bbp_raw_title', $title, $sep, $seplocation );
2619
 
2620
  // Compare new title with original title
2621
- if ( $title === $_title )
2622
  return $title;
2623
 
2624
  // Temporary separator, for accurate flipping, if necessary
2625
  $t_sep = '%WP_TITILE_SEP%';
2626
  $prefix = '';
2627
 
2628
- if ( !empty( $title ) )
2629
  $prefix = " $sep ";
2630
 
2631
  // sep on right, so reverse the order
2632
  if ( 'right' === $seplocation ) {
2633
- $title_array = array_reverse( explode( $t_sep, $title ) );
2634
- $title = implode( " $sep ", $title_array ) . $prefix;
2635
 
2636
  // sep on left, do not reverse
2637
  } else {
2638
- $title_array = explode( $t_sep, $title );
2639
- $title = $prefix . implode( " $sep ", $title_array );
2640
  }
2641
 
2642
  // Filter and return
2643
- return apply_filters( 'bbp_title', $title, $sep, $seplocation );
2644
  }
2501
  */
2502
  function bbp_title( $title = '', $sep = '»', $seplocation = '' ) {
2503
 
 
 
 
2504
  // Title array
2505
+ $new_title = array();
2506
 
2507
  /** Archives **************************************************************/
2508
 
2509
  // Forum Archive
2510
  if ( bbp_is_forum_archive() ) {
2511
+ $new_title['text'] = bbp_get_forum_archive_title();
2512
 
2513
  // Topic Archive
2514
  } elseif ( bbp_is_topic_archive() ) {
2515
+ $new_title['text'] = bbp_get_topic_archive_title();
2516
 
2517
  /** Edit ******************************************************************/
2518
 
2519
  // Forum edit page
2520
  } elseif ( bbp_is_forum_edit() ) {
2521
+ $new_title['text'] = bbp_get_forum_title();
2522
+ $new_title['format'] = esc_attr__( 'Forum Edit: %s', 'bbpress' );
2523
 
2524
  // Topic edit page
2525
  } elseif ( bbp_is_topic_edit() ) {
2526
+ $new_title['text'] = bbp_get_topic_title();
2527
+ $new_title['format'] = esc_attr__( 'Topic Edit: %s', 'bbpress' );
2528
 
2529
  // Reply edit page
2530
  } elseif ( bbp_is_reply_edit() ) {
2531
+ $new_title['text'] = bbp_get_reply_title();
2532
+ $new_title['format'] = esc_attr__( 'Reply Edit: %s', 'bbpress' );
2533
 
2534
  // Topic tag edit page
2535
  } elseif ( bbp_is_topic_tag_edit() ) {
2536
+ $new_title['text'] = bbp_get_topic_tag_name();
2537
+ $new_title['format'] = esc_attr__( 'Topic Tag Edit: %s', 'bbpress' );
2538
 
2539
  /** Singles ***************************************************************/
2540
 
2541
  // Forum page
2542
  } elseif ( bbp_is_single_forum() ) {
2543
+ $new_title['text'] = bbp_get_forum_title();
2544
+ $new_title['format'] = esc_attr__( 'Forum: %s', 'bbpress' );
2545
 
2546
  // Topic page
2547
  } elseif ( bbp_is_single_topic() ) {
2548
+ $new_title['text'] = bbp_get_topic_title();
2549
+ $new_title['format'] = esc_attr__( 'Topic: %s', 'bbpress' );
2550
 
2551
  // Replies
2552
  } elseif ( bbp_is_single_reply() ) {
2553
+ $new_title['text'] = bbp_get_reply_title();
2554
 
2555
  // Topic tag page
2556
  } elseif ( bbp_is_topic_tag() || get_query_var( 'bbp_topic_tag' ) ) {
2557
+ $new_title['text'] = bbp_get_topic_tag_name();
2558
+ $new_title['format'] = esc_attr__( 'Topic Tag: %s', 'bbpress' );
2559
 
2560
  /** Users *****************************************************************/
2561
 
2564
 
2565
  // Current users profile
2566
  if ( bbp_is_user_home() ) {
2567
+ $new_title['text'] = esc_attr__( 'Your Profile', 'bbpress' );
2568
 
2569
  // Other users profile
2570
  } else {
2571
+ $new_title['text'] = get_userdata( bbp_get_user_id() )->display_name;
2572
+ $new_title['format'] = esc_attr__( "%s's Profile", 'bbpress' );
2573
  }
2574
 
2575
  // Profile edit page
2577
 
2578
  // Current users profile
2579
  if ( bbp_is_user_home_edit() ) {
2580
+ $new_title['text'] = esc_attr__( 'Edit Your Profile', 'bbpress' );
2581
 
2582
  // Other users profile
2583
  } else {
2584
+ $new_title['text'] = get_userdata( bbp_get_user_id() )->display_name;
2585
+ $new_title['format'] = esc_attr__( "Edit %s's Profile", 'bbpress' );
2586
  }
2587
 
2588
  /** Views *****************************************************************/
2589
 
2590
  // Views
2591
  } elseif ( bbp_is_single_view() ) {
2592
+ $new_title['text'] = bbp_get_view_title();
2593
+ $new_title['format'] = esc_attr__( 'View: %s', 'bbpress' );
2594
 
2595
  /** Search ****************************************************************/
2596
 
2597
  // Search
2598
  } elseif ( bbp_is_search() ) {
2599
+ $new_title['text'] = bbp_get_search_title();
2600
  }
2601
 
2602
  // This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
2603
+ $new_title = apply_filters( 'bbp_raw_title_array', $new_title );
2604
 
2605
  // Set title array defaults
2606
+ $new_title = bbp_parse_args( $new_title, array(
2607
+ 'text' => $title,
2608
  'format' => '%s'
2609
  ), 'title' );
2610
 
2611
  // Get the formatted raw title
2612
+ $new_title = sprintf( $new_title['format'], $new_title['text'] );
2613
 
2614
  // Filter the raw title
2615
+ $new_title = apply_filters( 'bbp_raw_title', $new_title, $sep, $seplocation );
2616
 
2617
  // Compare new title with original title
2618
+ if ( $new_title === $title )
2619
  return $title;
2620
 
2621
  // Temporary separator, for accurate flipping, if necessary
2622
  $t_sep = '%WP_TITILE_SEP%';
2623
  $prefix = '';
2624
 
2625
+ if ( !empty( $new_title ) )
2626
  $prefix = " $sep ";
2627
 
2628
  // sep on right, so reverse the order
2629
  if ( 'right' === $seplocation ) {
2630
+ $new_title_array = array_reverse( explode( $t_sep, $new_title ) );
2631
+ $new_title = implode( " $sep ", $new_title_array ) . $prefix;
2632
 
2633
  // sep on left, do not reverse
2634
  } else {
2635
+ $new_title_array = explode( $t_sep, $new_title );
2636
+ $new_title = $prefix . implode( " $sep ", $new_title_array );
2637
  }
2638
 
2639
  // Filter and return
2640
+ return apply_filters( 'bbp_title', $new_title, $sep, $seplocation );
2641
  }
includes/common/widgets.php CHANGED
@@ -803,7 +803,7 @@ class BBP_Topics_Widget extends WP_Widget {
803
  $author_link = '';
804
 
805
  // Maybe get the topic author
806
- if ( 'on' === $settings['show_user'] ) :
807
  $author_link = bbp_get_topic_author_link( array( 'post_id' => $topic_id, 'type' => 'both', 'size' => 14 ) );
808
  endif; ?>
809
 
@@ -816,7 +816,7 @@ class BBP_Topics_Widget extends WP_Widget {
816
 
817
  <?php endif; ?>
818
 
819
- <?php if ( 'on' === $settings['show_date'] ) : ?>
820
 
821
  <div><?php bbp_topic_last_active_time( $topic_id ); ?></div>
822
 
@@ -1154,20 +1154,20 @@ class BBP_Replies_Widget extends WP_Widget {
1154
  $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . esc_attr( bbp_get_reply_excerpt( $reply_id, 50 ) ) . '">' . bbp_get_reply_topic_title( $reply_id ) . '</a>';
1155
 
1156
  // Only query user if showing them
1157
- if ( 'on' === $settings['show_user'] ) :
1158
  $author_link = bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) );
1159
  else :
1160
  $author_link = false;
1161
  endif;
1162
 
1163
  // Reply author, link, and timestamp
1164
- if ( ( 'on' === $settings['show_date'] ) && !empty( $author_link ) ) :
1165
 
1166
  // translators: 1: reply author, 2: reply link, 3: reply timestamp
1167
  printf( _x( '%1$s on %2$s %3$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' );
1168
 
1169
  // Reply link and timestamp
1170
- elseif ( 'on' === $settings['show_date'] ) :
1171
 
1172
  // translators: 1: reply link, 2: reply timestamp
1173
  printf( _x( '%1$s %2$s', 'widgets', 'bbpress' ), $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' );
803
  $author_link = '';
804
 
805
  // Maybe get the topic author
806
+ if ( ! empty( $settings['show_user'] ) ) :
807
  $author_link = bbp_get_topic_author_link( array( 'post_id' => $topic_id, 'type' => 'both', 'size' => 14 ) );
808
  endif; ?>
809
 
816
 
817
  <?php endif; ?>
818
 
819
+ <?php if ( ! empty( $settings['show_date'] ) ) : ?>
820
 
821
  <div><?php bbp_topic_last_active_time( $topic_id ); ?></div>
822
 
1154
  $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . esc_attr( bbp_get_reply_excerpt( $reply_id, 50 ) ) . '">' . bbp_get_reply_topic_title( $reply_id ) . '</a>';
1155
 
1156
  // Only query user if showing them
1157
+ if ( ! empty( $settings['show_user'] ) ) :
1158
  $author_link = bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) );
1159
  else :
1160
  $author_link = false;
1161
  endif;
1162
 
1163
  // Reply author, link, and timestamp
1164
+ if ( ! empty( $settings['show_date'] ) && !empty( $author_link ) ) :
1165
 
1166
  // translators: 1: reply author, 2: reply link, 3: reply timestamp
1167
  printf( _x( '%1$s on %2$s %3$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' );
1168
 
1169
  // Reply link and timestamp
1170
+ elseif ( ! empty( $settings['show_date'] ) ) :
1171
 
1172
  // translators: 1: reply link, 2: reply timestamp
1173
  printf( _x( '%1$s %2$s', 'widgets', 'bbpress' ), $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' );
includes/core/theme-compat.php CHANGED
@@ -432,6 +432,16 @@ function bbp_theme_compat_reset_post( $args = array() ) {
432
  */
433
  function bbp_template_include_theme_compat( $template = '' ) {
434
 
 
 
 
 
 
 
 
 
 
 
435
  /**
436
  * If BuddyPress is activated at a network level, the action order is
437
  * reversed, which causes the template integration to fail. If we're looking
432
  */
433
  function bbp_template_include_theme_compat( $template = '' ) {
434
 
435
+ /**
436
+ * Bail if a root template was already found. This prevents unintended
437
+ * recursive filtering of 'the_content'.
438
+ *
439
+ * @link http://bbpress.trac.wordpress.org/ticket/2429
440
+ */
441
+ if ( bbp_is_template_included() ) {
442
+ return $template;
443
+ }
444
+
445
  /**
446
  * If BuddyPress is activated at a network level, the action order is
447
  * reversed, which causes the template integration to fail. If we're looking
includes/forums/functions.php CHANGED
@@ -169,8 +169,9 @@ function bbp_new_forum_handler( $action = '' ) {
169
  /** Forum Parent **********************************************************/
170
 
171
  // Forum parent was passed (the norm)
172
- if ( !empty( $_POST['bbp_forum_parent_id'] ) )
173
- $forum_parent_id = (int) $_POST['bbp_forum_parent_id'];
 
174
 
175
  // Filter and sanitize
176
  $forum_parent_id = apply_filters( 'bbp_new_forum_pre_parent_id', $forum_parent_id );
@@ -415,8 +416,8 @@ function bbp_edit_forum_handler( $action = '' ) {
415
  /** Forum Parent ***********************************************************/
416
 
417
  // Forum parent id was passed
418
- if ( is_numeric( $_POST['bbp_forum_parent_id'] ) ) {
419
- $forum_parent_id = (int) $_POST['bbp_forum_parent_id'];
420
  }
421
 
422
  // Current forum this forum is in
@@ -801,10 +802,9 @@ function bbp_publicize_forum( $forum_id = 0, $current_visibility = '' ) {
801
  if ( bbp_get_public_status_id() !== $current_visibility ) {
802
 
803
  // Update forums visibility setting
804
- wp_insert_post( array(
805
- 'ID' => $forum_id,
806
- 'post_status' => bbp_get_public_status_id()
807
- ) );
808
  }
809
 
810
  do_action( 'bbp_publicized_forum', $forum_id );
@@ -851,10 +851,9 @@ function bbp_privatize_forum( $forum_id = 0, $current_visibility = '' ) {
851
  update_option( '_bbp_private_forums', array_unique( array_filter( array_values( $private ) ) ) );
852
 
853
  // Update forums visibility setting
854
- wp_insert_post( array(
855
- 'ID' => $forum_id,
856
- 'post_status' => bbp_get_private_status_id()
857
- ) );
858
  }
859
 
860
  do_action( 'bbp_privatized_forum', $forum_id );
@@ -901,10 +900,9 @@ function bbp_hide_forum( $forum_id = 0, $current_visibility = '' ) {
901
  update_option( '_bbp_hidden_forums', array_unique( array_filter( array_values( $hidden ) ) ) );
902
 
903
  // Update forums visibility setting
904
- wp_insert_post( array(
905
- 'ID' => $forum_id,
906
- 'post_status' => bbp_get_hidden_status_id()
907
- ) );
908
  }
909
 
910
  do_action( 'bbp_hid_forum', $forum_id );
169
  /** Forum Parent **********************************************************/
170
 
171
  // Forum parent was passed (the norm)
172
+ if ( !empty( $_POST['bbp_forum_parent_id'] ) ) {
173
+ $forum_parent_id = bbp_get_forum_id( $_POST['bbp_forum_parent_id'] );
174
+ }
175
 
176
  // Filter and sanitize
177
  $forum_parent_id = apply_filters( 'bbp_new_forum_pre_parent_id', $forum_parent_id );
416
  /** Forum Parent ***********************************************************/
417
 
418
  // Forum parent id was passed
419
+ if ( !empty( $_POST['bbp_forum_parent_id'] ) ) {
420
+ $forum_parent_id = bbp_get_forum_id( $_POST['bbp_forum_parent_id'] );
421
  }
422
 
423
  // Current forum this forum is in
802
  if ( bbp_get_public_status_id() !== $current_visibility ) {
803
 
804
  // Update forums visibility setting
805
+ global $wpdb;
806
+ $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_public_status_id() ), array( 'ID' => $forum_id ) );
807
+ wp_transition_post_status( bbp_get_public_status_id(), $current_visibility, get_post( $forum_id ) );
 
808
  }
809
 
810
  do_action( 'bbp_publicized_forum', $forum_id );
851
  update_option( '_bbp_private_forums', array_unique( array_filter( array_values( $private ) ) ) );
852
 
853
  // Update forums visibility setting
854
+ global $wpdb;
855
+ $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_private_status_id() ), array( 'ID' => $forum_id ) );
856
+ wp_transition_post_status( bbp_get_private_status_id(), $current_visibility, get_post( $forum_id ) );
 
857
  }
858
 
859
  do_action( 'bbp_privatized_forum', $forum_id );
900
  update_option( '_bbp_hidden_forums', array_unique( array_filter( array_values( $hidden ) ) ) );
901
 
902
  // Update forums visibility setting
903
+ global $wpdb;
904
+ $wpdb->update( $wpdb->posts, array( 'post_status' => bbp_get_hidden_status_id() ), array( 'ID' => $forum_id ) );
905
+ wp_transition_post_status( bbp_get_hidden_status_id(), $current_visibility, get_post( $forum_id ) );
 
906
  }
907
 
908
  do_action( 'bbp_hid_forum', $forum_id );
includes/forums/template.php CHANGED
@@ -157,11 +157,11 @@ function bbp_forum_id( $forum_id = 0 ) {
157
  $bbp_forum_id = $bbp->search_query->post->ID;
158
 
159
  // Currently viewing a forum
160
- } elseif ( bbp_is_single_forum() && !empty( $bbp->current_forum_id ) ) {
161
  $bbp_forum_id = $bbp->current_forum_id;
162
 
163
  // Currently viewing a forum
164
- } elseif ( bbp_is_single_forum() && isset( $wp_query->post->ID ) ) {
165
  $bbp_forum_id = $wp_query->post->ID;
166
 
167
  // Currently viewing a topic
157
  $bbp_forum_id = $bbp->search_query->post->ID;
158
 
159
  // Currently viewing a forum
160
+ } elseif ( ( bbp_is_single_forum() || bbp_is_forum_edit() ) && !empty( $bbp->current_forum_id ) ) {
161
  $bbp_forum_id = $bbp->current_forum_id;
162
 
163
  // Currently viewing a forum
164
+ } elseif ( ( bbp_is_single_forum() || bbp_is_forum_edit() ) && isset( $wp_query->post->ID ) ) {
165
  $bbp_forum_id = $wp_query->post->ID;
166
 
167
  // Currently viewing a topic
includes/search/template.php CHANGED
@@ -312,7 +312,7 @@ function bbp_search_results_url() {
312
 
313
  // Append search terms
314
  if ( !empty( $search_terms ) ) {
315
- $url = user_trailingslashit( $url ) . user_trailingslashit( urlencode( $search_terms ) );
316
  }
317
 
318
  // Run through home_url()
312
 
313
  // Append search terms
314
  if ( !empty( $search_terms ) ) {
315
+ $url = trailingslashit( $url ) . user_trailingslashit( urlencode( $search_terms ) );
316
  }
317
 
318
  // Run through home_url()
includes/users/template.php CHANGED
@@ -1142,7 +1142,7 @@ function bbp_user_topics_created_url( $user_id = 0 ) {
1142
 
1143
  // Pretty permalinks
1144
  if ( $wp_rewrite->using_permalinks() ) {
1145
- $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . bbp_get_user_rewrite_id() . '%/topics';
1146
  $user = get_userdata( $user_id );
1147
  if ( ! empty( $user->user_nicename ) ) {
1148
  $user_nicename = $user->user_nicename;
@@ -1202,7 +1202,7 @@ function bbp_user_replies_created_url( $user_id = 0 ) {
1202
 
1203
  // Pretty permalinks
1204
  if ( $wp_rewrite->using_permalinks() ) {
1205
- $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . bbp_get_user_rewrite_id() . '%/replies';
1206
  $user = get_userdata( $user_id );
1207
  if ( ! empty( $user->user_nicename ) ) {
1208
  $user_nicename = $user->user_nicename;
1142
 
1143
  // Pretty permalinks
1144
  if ( $wp_rewrite->using_permalinks() ) {
1145
+ $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . bbp_get_user_rewrite_id() . '%/' . bbp_get_topic_archive_slug();
1146
  $user = get_userdata( $user_id );
1147
  if ( ! empty( $user->user_nicename ) ) {
1148
  $user_nicename = $user->user_nicename;
1202
 
1203
  // Pretty permalinks
1204
  if ( $wp_rewrite->using_permalinks() ) {
1205
+ $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . bbp_get_user_rewrite_id() . '%/' . bbp_get_reply_archive_slug();
1206
  $user = get_userdata( $user_id );
1207
  if ( ! empty( $user->user_nicename ) ) {
1208
  $user_nicename = $user->user_nicename;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: matt, johnjamesjacoby, jmdodd
3
  Tags: forums, discussion, support, theme, akismet, multisite
4
  Requires at least: 3.6
5
  Tested up to: 3.6
6
- Stable tag: 2.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -42,6 +42,14 @@ We're keeping things as small and light as possible while still allowing for gre
42
 
43
  == Changelog ==
44
 
 
 
 
 
 
 
 
 
45
  = 2.4 =
46
  * Added hierarchical reply support
47
  * Added ability to disable forum search
3
  Tags: forums, discussion, support, theme, akismet, multisite
4
  Requires at least: 3.6
5
  Tested up to: 3.6
6
+ Stable tag: 2.4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
42
 
43
  == Changelog ==
44
 
45
+ = 2.4.1 =
46
+ * Fix forum status saving
47
+ * Fix widget settings saving
48
+ * Fix custom wp_title compatibility
49
+ * Fix search results custom permalink compatibility
50
+ * Fix custom user topics & replies pages
51
+ * Fix hierarchical reply handling in converter
52
+
53
  = 2.4 =
54
  * Added hierarchical reply support
55
  * Added ability to disable forum search