Skip to:
Content

bbPress.org

Changeset 7268


Ignore:
Timestamp:
06/28/2024 10:02:43 PM (13 months ago)
Author:
johnjamesjacoby
Message:

Merge r7250 through r7267 from branches/2.6.

In trunk, for 2.7.

Location:
trunk
Files:
1 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/bbpress.php

    r7232 r7268  
    2323 * Domain Path:       /languages/
    2424 * Requires PHP:      5.6.20
    25  * Requires at least: 5.0
     25 * Requires at least: 6.0
     26 * Tested up to:      6.5
    2627 * Version:           2.7.0-alpha-2
    2728 */
  • trunk/package.json

    r7219 r7268  
    11{
    22    "name": "bbpress",
     3    "author": "The bbPress Contributors",
    34    "author": "The bbPress Contributors",
    45    "description": "Forum software with a twist from the creators of WordPress.",
  • trunk/src/bbpress.php

    r7232 r7268  
    2323 * Domain Path:       /languages/
    2424 * Requires PHP:      5.6.20
    25  * Requires at least: 5.0
     25 * Requires at least: 6.0
     26 * Tested up to:      6.5
    2627 * Version:           2.7.0-alpha-2
    2728 */
  • trunk/src/includes/admin/assets/css/admin.css

    r7171 r7268  
    11
    2 /* Kludge for too-wide forums dropdown */
     2/* Kludge for too-wide inputs & selects */
    33#poststuff #bbp_forum_attributes select#parent_id,
     4#poststuff #bbp_forum_attributes input#menu_order,
    45#poststuff #bbp_topic_attributes select#parent_id,
    56#poststuff #bbp_reply_attributes select#bbp_forum_id,
    6 #poststuff #bbp_reply_attributes select#bbp_reply_to {
     7#poststuff #bbp_reply_attributes select#bbp_reply_to,
     8#poststuff #bbp_reply_attributes input#bbp_forum_id,
     9#poststuff #bbp_reply_attributes input#bbp_topic_id,
     10#poststuff #bbp_author_metabox input#bbp_author_id,
     11#poststuff #bbp_author_metabox input#bbp_author_ip_address {
    712    max-width: 170px;
    813}
     
    316321}
    317322
     323body.post-type-forum .wp-list-table thead th a,
     324body.post-type-forum .wp-list-table tfoot th a,
     325body.post-type-topic .wp-list-table thead th a,
     326body.post-type-topic .wp-list-table tfoot th a,
     327body.post-type-reply .wp-list-table thead th a,
     328body.post-type-reply .wp-list-table tfoot th a {
     329    display: flex;
     330}
     331
     332body.post-type-forum .wp-list-table thead th:not(.sortable),
     333body.post-type-forum .wp-list-table tfoot th:not(.sortable),
     334body.post-type-forum .wp-list-table thead th a > span:first-child,
     335body.post-type-forum .wp-list-table tfoot th a > span:first-child,
     336body.post-type-forum .wp-list-table tbody td,
     337body.post-type-topic .wp-list-table thead th:not(.sortable),
     338body.post-type-topic .wp-list-table tfoot th:not(.sortable),
     339body.post-type-topic .wp-list-table thead th a > span:first-child,
     340body.post-type-topic .wp-list-table tfoot th a > span:first-child,
     341body.post-type-topic .wp-list-table tbody td,
     342body.post-type-reply .wp-list-table thead th:not(.sortable),
     343body.post-type-reply .wp-list-table tfoot th:not(.sortable),
     344body.post-type-reply .wp-list-table thead th a > span:first-child,
     345body.post-type-reply .wp-list-table tfoot th a > span:first-child,
     346body.post-type-reply .wp-list-table tbody td {
     347    overflow-x: hidden;
     348    text-overflow: ellipsis;
     349    word-wrap: normal;
     350}
     351
    318352.column-bbp_forum_topic_count,
    319353.column-bbp_forum_reply_count,
  • trunk/src/includes/admin/classes/class-bbp-admin.php

    r7190 r7268  
    8282     */
    8383    public $notices = array();
     84
     85    /** Components ************************************************************/
     86
     87    /**
     88     * @var BBP_Forums_Admin Forums admin
     89     */
     90    public $forums = null;
     91
     92    /**
     93     * @var BBP_Topics_Admin Topics admin
     94     */
     95    public $topics = null;
     96
     97    /**
     98     * @var BBP_Replies_Admin Replies admin
     99     */
     100    public $replies = null;
     101
     102    /**
     103     * @var BBP_Converter Converter admin
     104     */
     105    public $converter = null;
    84106
    85107    /** Functions *************************************************************/
  • trunk/src/includes/admin/classes/class-bbp-converter-db.php

    r6785 r7268  
    3131     */
    3232    public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
    33         register_shutdown_function( array( $this, '__destruct' ) );
    3433
    3534        if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
  • trunk/src/includes/admin/tools/repair.php

    r7134 r7268  
    498498    $result      = esc_html__( 'Failed!', 'bbpress' );
    499499
    500     $sql_select  = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "' GROUP BY `post_author`";
     500    $sql_type    = bbp_get_topic_post_type();
     501    $sql_status  = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'";
     502    $sql_select  = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status}) GROUP BY `post_author`";
    501503    $insert_rows = $bbp_db->get_results( $sql_select );
    502504
     
    542544
    543545    // Define variables
    544     $bbp_db    = bbp_db();
     546    $bbp_db      = bbp_db();
    545547    $statement   = esc_html__( 'Counting the number of topics to which each user has replied… %s', 'bbpress' );
    546548    $result      = esc_html__( 'Failed!', 'bbpress' );
    547549
    548     $sql_select  = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_reply_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "' GROUP BY `post_author`";
     550    $sql_type    = bbp_get_reply_post_type();
     551    $sql_status  = "'" . implode( "','", bbp_get_public_reply_statuses() ) . "'";
     552    $sql_select  = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status}) GROUP BY `post_author`";
    549553    $insert_rows = $bbp_db->get_results( $sql_select );
    550554
     
    602606    }
    603607
    604     $topics = $bbp_db->get_col( "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "'" );
    605 
     608    $sql_type   = bbp_get_topic_post_type();
     609    $sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'";
     610    $sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})";
     611
     612    $topics = $bbp_db->get_col( $sql_select );
    606613    if ( is_wp_error( $topics ) ) {
    607614        return array( 2, sprintf( $statement, $result ) );
     
    668675    }
    669676
    670     $topics = $bbp_db->get_col( "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "'" );
     677    $sql_type    = bbp_get_topic_post_type();
     678    $sql_status  = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'";
     679    $sql_select  = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})";
     680
     681    $topics = $bbp_db->get_col( $sql_select );
    671682    if ( is_wp_error( $topics ) ) {
    672683        return array( 2, sprintf( $statement, $result ) );
     
    733744    }
    734745
    735     $forums = $bbp_db->get_col( "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_forum_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "'" );
     746    $sql_type    = bbp_get_forum_post_type();
     747    $sql_status  = "'" . implode( "','", bbp_get_public_forum_statuses() ) . "'";
     748    $sql_select  = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})";
     749
     750    $forums = $bbp_db->get_col( $sql_select );
    736751    if ( is_wp_error( $forums ) ) {
    737752        return array( 2, sprintf( $statement, $result ) );
  • trunk/src/includes/common/functions.php

    r7249 r7268  
    484484
    485485        // Declare empty arrays
    486         $topics = $topic_titles = array_fill_keys( bbp_get_non_public_reply_statuses(), '' );
     486        $replies = $reply_titles = array_fill_keys( bbp_get_non_public_reply_statuses(), '' );
    487487
    488488        // Pending
     
    517517
    518518        // Total hidden (pending, private, hidden, spam, trash)
    519         $reply_count_hidden = array_sum( $replies );
     519        $reply_count_hidden = array_sum( array_filter( $replies ) );
    520520
    521521        // Compile the hidden replies title
     
    25202520                $the_query = bbp_get_view_query_args( $view );
    25212521
    2522                 // Output the feed
    2523                 bbp_display_topics_feed_rss2( $the_query );
     2522                // Output the feed if view exists
     2523                if ( ! empty( $the_query ) ) {
     2524                    bbp_display_topics_feed_rss2( $the_query );
     2525                }
    25242526            }
    25252527        }
  • trunk/src/includes/core/capabilities.php

    r6777 r7268  
    286286function bbp_add_forums_roles( $wp_roles = null ) {
    287287
     288    // Maybe initialize WP_Roles just-in-time, but
     289    if ( empty( $wp_roles ) && ! doing_action( 'wp_roles_init' ) ) {
     290        $wp_roles = wp_roles();
     291    }
     292
     293    // Bail if unexpected param type
     294    if ( ! is_a( $wp_roles, 'WP_Roles' ) ) {
     295        return;
     296    }
     297
    288298    // Get the dynamic roles
    289299    $bbp_roles = bbp_get_dynamic_roles();
  • trunk/src/includes/extend/akismet.php

    r7226 r7268  
    2121 */
    2222class BBP_Akismet {
     23
     24    /**
     25     * The last post checked by Akismet.
     26     *
     27     * @since 2.0.0 bbPress (r3277)
     28     *
     29     * @var array $last_post Default empty array.
     30     */
     31    protected $last_post = array();
    2332
    2433    /**
  • trunk/src/includes/forums/functions.php

    r7207 r7268  
    23022302    }
    23032303
    2304     // Get query post types array .
    2305     $post_types = (array) $posts_query->get( 'post_type' );
     2304    // Bail to prevent unintended wp-admin post_row overrides
     2305    if ( is_admin() && isset( $_REQUEST['post_status'] ) ) {
     2306        return;
     2307    }
     2308
     2309    // Get query post types as an array.
     2310    $post_types = array_filter( (array) $posts_query->get( 'post_type' ) );
    23062311
    23072312    // Forums
    2308     if ( bbp_get_forum_post_type() === implode( '', $post_types ) ) {
    2309 
    2310         // Prevent accidental wp-admin post_row override
    2311         if ( is_admin() && isset( $_REQUEST['post_status'] ) ) {
    2312             return;
    2313         }
     2313    if ( in_array( bbp_get_forum_post_type(), $post_types, true ) ) {
    23142314
    23152315        /** Default ***********************************************************/
     
    23192319
    23202320        // Get forums to exclude
    2321         $hidden_ids = bbp_exclude_forum_ids( 'array' );
    2322 
    2323         // Bail if no forums to exclude
    2324         if ( empty( $hidden_ids ) ) {
    2325             return;
    2326         }
    2327 
    2328         // Get any existing meta queries
    2329         $not_in = $posts_query->get( 'post__not_in', array() );
    2330 
    2331         // Add our meta query to existing
    2332         $not_in = array_unique( array_merge( $not_in, $hidden_ids ) );
    2333 
    2334         // Set the meta_query var
    2335         $posts_query->set( 'post__not_in', $not_in );
     2321        $forum_ids = bbp_exclude_forum_ids( 'array' );
     2322
     2323        // Excluding some forums
     2324        if ( ! empty( $forum_ids ) ) {
     2325
     2326            // Get any existing not-in queries
     2327            $not_in = $posts_query->get( 'post__not_in', array() );
     2328
     2329            // Add our not-in to existing
     2330            $not_in = array_unique( array_merge( $not_in, $forum_ids ) );
     2331
     2332            // Set the new not-in val
     2333            $posts_query->set( 'post__not_in', $not_in );
     2334        }
     2335    }
    23362336
    23372337    // Some other post type besides Forums, Topics, or Replies
    2338     } elseif ( ! array_diff( $post_types, bbp_get_post_types() ) ) {
     2338    if ( ! array_diff( $post_types, bbp_get_post_types() ) ) {
    23392339
    23402340        // Get forums to exclude
    23412341        $forum_ids = bbp_exclude_forum_ids( 'meta_query' );
    23422342
    2343         // Bail if no forums to exclude
    2344         if ( empty( $forum_ids ) ) {
    2345             return;
    2346         }
    2347 
    2348         // Get any existing meta queries
    2349         $meta_query   = (array) $posts_query->get( 'meta_query', array() );
    2350 
    2351         // Add our meta query to existing
    2352         $meta_query[] = $forum_ids;
    2353 
    2354         // Set the meta_query var
    2355         $posts_query->set( 'meta_query', $meta_query );
     2343        // Excluding some forums
     2344        if ( ! empty( $forum_ids ) ) {
     2345
     2346            // Get any existing meta queries
     2347            $meta_query   = (array) $posts_query->get( 'meta_query', array() );
     2348
     2349            // Add our meta query to existing
     2350            $meta_query[] = $forum_ids;
     2351
     2352            // Set the new meta_query val
     2353            $posts_query->set( 'meta_query', $meta_query );
     2354        }
    23562355    }
    23572356}
  • trunk/src/includes/replies/functions.php

    r7241 r7268  
    641641    /** Reply Status **********************************************************/
    642642
     643    // Get available reply statuses
     644    $reply_statuses = bbp_get_reply_statuses( $reply_id );
     645
    643646    // Use existing post_status
    644647    $reply_status = $reply->post_status;
     
    647650    if ( bbp_is_reply_public( $reply_id ) && ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    648651        $reply_status = bbp_get_pending_status_id();
     652
     653    // Check for possible posted reply status
     654    } elseif ( ! empty( $_POST['bbp_reply_status'] ) && in_array( $_POST['bbp_reply_status'], array_keys( $reply_statuses ), true ) ) {
     655
     656        // Allow capable users to explicitly override the status
     657        if ( current_user_can( 'moderate', $reply_id ) ) {
     658            $reply_status = sanitize_key( $_POST['bbp_reply_status'] );
     659
     660        // Not capable
     661        } else {
     662            bbp_add_error( 'bbp_edit_reply_status', __( '<strong>Error</strong>: You do not have permission to do that.', 'bbpress' ) );
     663        }
    649664    }
    650665
     
    20602075 *
    20612076 * @param string $where
     2077 * @param WP_Query $query
    20622078 * @return string
    20632079 */
  • trunk/src/includes/replies/template.php

    r7248 r7268  
    800800 *
    801801 * @param int $reply_id Optional. Reply id
    802  * @return string reply revisions
     802 * @return WP_Post[]|int[] reply revisions
    803803 */
    804804function bbp_get_reply_revisions( $reply_id = 0 ) {
  • trunk/src/includes/search/template.php

    r7175 r7268  
    4747    }
    4848
    49     // What are the default allowed statuses (based on user caps)
    50     if ( bbp_get_view_all() ) {
    51 
    52         // Default view=all statuses
    53         $post_statuses = array_keys( bbp_get_topic_statuses() );
    54 
    55         // Add support for private status
    56         if ( current_user_can( 'read_private_topics' ) ) {
    57             $post_statuses[] = bbp_get_private_status_id();
    58         }
    59 
    60         // Join post statuses together
    61         $default['post_status'] = $post_statuses;
    62 
    63     // Lean on the 'perm' query var value of 'readable' to provide statuses
    64     } else {
    65         $default['perm'] = 'readable';
    66     }
     49    // Default public statuses (topics coincidentally cover all post types)
     50    $post_statuses = array_keys( bbp_get_public_topic_statuses() );
     51
     52    // Add support for private status
     53    if ( current_user_can( 'read_private_topics' ) ) {
     54        $post_statuses[] = bbp_get_private_status_id();
     55    }
     56
     57    // Add support for hidden status
     58    if ( current_user_can( 'read_hidden_topics' ) ) {
     59        $post_statuses[] = bbp_get_hidden_status_id();
     60    }
     61
     62    // Join post statuses together
     63    $default['post_status'] = $post_statuses;
    6764
    6865    /** Setup *****************************************************************/
  • trunk/src/includes/topics/functions.php

    r7207 r7268  
    580580
    581581    // Maybe force into pending
    582     if ( bbp_is_topic_public( $topic->ID ) && ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
     582    if ( bbp_is_topic_public( $topic_id ) && ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    583583        $topic_status = bbp_get_pending_status_id();
    584584
     
    587587
    588588        // Allow capable users to explicitly override the status
    589         if ( current_user_can( 'moderate', $forum_id ) ) {
     589        if ( current_user_can( 'moderate', $topic_id ) ) {
    590590            $topic_status = sanitize_key( $_POST['bbp_topic_status'] );
    591591
  • trunk/src/includes/topics/template.php

    r7248 r7268  
    964964 *
    965965 * @param int $topic_id Optional. Topic id
    966  * @return string Topic revisions
     966 * @return WP_Post[]|int[] Topic revisions
    967967 */
    968968function bbp_get_topic_revisions( $topic_id = 0 ) {
  • trunk/src/readme.txt

    r7232 r7268  
    55License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    66Requires PHP:      5.6.20
    7 Requires at least: 5.0
    8 Tested up to:      5.9
     7Requires at least: 6.0
     8Tested up to:      6.5
    99Stable tag:        2.7.0-alpha-2
    1010
  • trunk/src/templates/default/bbpress/content-archive-topic.php

    r6258 r7268  
    1515<div id="bbpress-forums" class="bbpress-wrapper">
    1616
    17     <?php if ( bbp_allow_search() ) : ?>
    18 
    19         <div class="bbp-search-form">
    20 
    21             <?php bbp_get_template_part( 'form', 'search' ); ?>
    22 
    23         </div>
    24 
    25     <?php endif; ?>
     17    <?php bbp_get_template_part( 'form', 'search' ); ?>
    2618
    2719    <?php bbp_breadcrumb(); ?>
  • trunk/src/templates/default/bbpress/content-search.php

    r7048 r7268  
    1515<div id="bbpress-forums" class="bbpress-wrapper">
    1616
     17    <?php bbp_get_template_part( 'form', 'search' ); ?>
     18
    1719    <?php bbp_breadcrumb(); ?>
    1820
     
    2931        <?php bbp_get_template_part( 'pagination', 'search' ); ?>
    3032
    31     <?php elseif ( bbp_get_search_terms() ) : ?>
     33    <?php else : ?>
    3234
    3335        <?php bbp_get_template_part( 'feedback',   'no-search' ); ?>
    34 
    35     <?php else : ?>
    36 
    37         <?php bbp_get_template_part( 'form', 'search' ); ?>
    3836
    3937    <?php endif; ?>
  • trunk/src/templates/default/bbpress/feedback-no-search.php

    r6258 r7268  
    1111defined( 'ABSPATH' ) || exit;
    1212
    13 ?>
     13if ( bbp_get_search_terms() ) : ?>
    1414
    1515<div class="bbp-template-notice">
     
    1818    </ul>
    1919</div>
     20
     21<?php else : ?>
     22
     23<div class="bbp-template-notice">
     24    <ul>
     25        <li><?php esc_html_e( 'Please enter some search terms.', 'bbpress' ); ?></li>
     26    </ul>
     27</div>
     28
     29<?php endif;
  • trunk/src/templates/default/bbpress/form-forum.php

    r7006 r7268  
    8585                    <?php do_action( 'bbp_theme_after_forum_form_content' ); ?>
    8686
    87                     <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
    88 
    89                         <p class="form-allowed-tags">
    90                             <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'bbpress' ); ?></label><br />
    91                             <code><?php bbp_allowed_tags(); ?></code>
    92                         </p>
    93 
    94                     <?php endif; ?>
     87                    <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?>
    9588
    9689                    <?php if ( bbp_allow_forum_mods() && current_user_can( 'assign_moderators' ) ) : ?>
  • trunk/src/templates/default/bbpress/form-reply.php

    r7006 r7268  
    7474                    <?php do_action( 'bbp_theme_after_reply_form_content' ); ?>
    7575
    76                     <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
    77 
    78                         <p class="form-allowed-tags">
    79                             <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'bbpress' ); ?></label><br />
    80                             <code><?php bbp_allowed_tags(); ?></code>
    81                         </p>
    82 
    83                     <?php endif; ?>
     76                    <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?>
    8477
    8578                    <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
  • trunk/src/templates/default/bbpress/form-topic.php

    r6806 r7268  
    9595                    <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
    9696
    97                     <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
    98 
    99                         <p class="form-allowed-tags">
    100                             <label><?php printf( esc_html__( 'You may use these %s tags and attributes:', 'bbpress' ), '<abbr title="HyperText Markup Language">HTML</abbr>' ); ?></label><br />
    101                             <code><?php bbp_allowed_tags(); ?></code>
    102                         </p>
    103 
    104                     <?php endif; ?>
     97                    <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?>
    10598
    10699                    <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
Note: See TracChangeset for help on using the changeset viewer.