Skip to:
Content

BuddyPress.org

Changeset 11771


Ignore:
Timestamp:
12/12/2017 03:07:29 PM (7 years ago)
Author:
djpaul
Message:

2.9 branch - fix Classic Forums compatibility with WordPress 4.7+.

  • Fixes the fatal error when using WP 4.7+.
  • Fixes issues with installing the old bbPress DB tables with utf8mb4, as of WP 4.2+.
  • When installing the old bbPress DB tables, do not attempt to modify the wp_users DB table.
  • Fixes the topic title not displaying in newer themes using document title in WP 4.4+.
  • Adds a performance tweak when bp_get_forum_topic_posts() is used more than once on the same forum topic page.

Props r-a-y

Fixes #7502

Location:
branches/2.9/src/bp-forums
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.9/src/bp-forums/bp-forums-bbpress-sa.php

    r11366 r11771  
    3838
    3939    require( BB_PATH . BB_INC . 'class.bb-query.php' );
    40     require( BB_PATH . BB_INC . 'class.bb-walker.php' );
     40    @require( BB_PATH . BB_INC . 'class.bb-walker.php' );
    4141
    4242    require( BB_PATH . BB_INC . 'functions.bb-core.php' );
     
    5151    require( BB_PATH . BB_INC . 'functions.bb-template.php' );
    5252
    53     require( BACKPRESS_PATH . 'class.wp-taxonomy.php' );
    54     require( BB_PATH . BB_INC . 'class.bb-taxonomy.php' );
    55 
    56     require( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
     53    require( $bp->plugin_dir . '/bp-forums/class.backpress-taxonomy.php' );
     54    require( $bp->plugin_dir . '/bp-forums/class.bb-taxonomy.php' );
     55
     56    @require( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
    5757
    5858    $bb = new stdClass();
     
    125125    // Check if the tables are installed, if not, install them.
    126126    if ( !$tables_installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A ) ) {
     127        // Do not alter wp_users table.
     128        if ( ! defined( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES' ) ) {
     129            define( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES', true );
     130        }
     131
    127132        require( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
    128133
    129134        // Backticks and "IF NOT EXISTS" break the dbDelta function.
    130         bp_bb_dbDelta( str_replace( ' IF NOT EXISTS', '', str_replace( '`', '', $bb_queries ) ) );
    131 
     135        $bb_queries = str_replace( ' IF NOT EXISTS', '', str_replace( '`', '', $bb_queries ) );
     136
     137        // Fix issue with utf8mb4 in WP 4.2+ and bbPress DB schema (bb_terms/bb_meta)
     138        $bb_queries = str_replace( array( 'varchar(200)', 'varchar(255)' ), 'varchar(191)', $bb_queries );
     139
     140        // Do the DB!
     141        bp_bb_dbDelta( $bb_queries );
    132142        require( BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php' );
    133143        bb_update_db_version();
  • branches/2.9/src/bp-forums/bp-forums-filters.php

    r10821 r11771  
    170170
    171171/**
     172 * Append forum topic to document title.
     173 *
     174 * @since 2.9.0
     175 *
     176 * @param array $bp_title The BuddyPress page title parts.
     177 * @param array $title    The original WordPress title parts.
     178 */
     179function bp_forums_add_forum_topic_to_document_title( $bp_title, $title ) {
     180    if ( bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) && bp_has_forum_topic_posts() ) {
     181        /** This filter is documented in wp-includes/general-template.php */
     182        $sep = apply_filters( 'document_title_separator', '-' );
     183
     184        $bp_title['title'] = bp_get_the_topic_title() . " $sep " . $bp_title['title'];
     185    }
     186
     187    return $bp_title;
     188}
     189add_filter( 'bp_modify_document_title_parts', 'bp_forums_add_forum_topic_to_document_title', 10, 2 );
     190
     191/**
    172192 * Remove the anchor tag autogenerated for at-mentions when forum topics and posts are edited.
    173193 *
  • branches/2.9/src/bp-forums/bp-forums-template.php

    r11606 r11771  
    24262426
    24272427    } else {
    2428         $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );
     2428        if ( empty( $topic_template ) ) {
     2429            $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );
     2430        }
    24292431
    24302432        // Current topic forum_id needs to match current_group forum_id.
Note: See TracChangeset for help on using the changeset viewer.