Skip to content

Commit

Permalink
Update plugin: bbpress.
Browse files Browse the repository at this point in the history
Name: bbPress
New version: 2.6.11
Previous version: 2.6.9
  • Loading branch information
boonebgorges committed Jul 9, 2024
1 parent 7274454 commit 173f056
Show file tree
Hide file tree
Showing 34 changed files with 554 additions and 358 deletions.
12 changes: 7 additions & 5 deletions wp-content/plugins/bbpress/bbpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* bbPress is forum software with a twist from the creators of WordPress.
*
* $Id: bbpress.php 7228 2021-11-29 15:22:27Z johnjamesjacoby $
* $Id: bbpress.php 7273 2024-06-29 16:56:00Z johnjamesjacoby $
*
* @package bbPress
* @subpackage Main
Expand All @@ -17,12 +17,14 @@
* Description: bbPress is forum software with a twist from the creators of WordPress.
* Author: The bbPress Contributors
* Author URI: https://bbpress.org
* Version: 2.6.9
* License: GNU General Public License v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: bbpress
* Domain Path: /languages/
* License: GPLv2 or later (license.txt)
* Requires PHP: 5.6.20
* Requires at least: 5.0
* Requires at least: 6.0
* Tested up to: 6.5
* Version: 2.6.11
*/

// Exit if accessed directly
Expand Down Expand Up @@ -205,7 +207,7 @@ private function setup_environment() {

/** Versions **********************************************************/

$this->version = '2.6.9';
$this->version = '2.6.11';
$this->db_version = '263';

/** Paths *************************************************************/
Expand Down
38 changes: 36 additions & 2 deletions wp-content/plugins/bbpress/includes/admin/assets/css/admin.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@

/* Kludge for too-wide forums dropdown */
/* Kludge for too-wide inputs & selects */
#poststuff #bbp_forum_attributes select#parent_id,
#poststuff #bbp_forum_attributes input#menu_order,
#poststuff #bbp_topic_attributes select#parent_id,
#poststuff #bbp_reply_attributes select#bbp_forum_id,
#poststuff #bbp_reply_attributes select#bbp_reply_to {
#poststuff #bbp_reply_attributes select#bbp_reply_to,
#poststuff #bbp_reply_attributes input#bbp_forum_id,
#poststuff #bbp_reply_attributes input#bbp_topic_id,
#poststuff #bbp_author_metabox input#bbp_author_id,
#poststuff #bbp_author_metabox input#bbp_author_ip_address {
max-width: 170px;
}

Expand Down Expand Up @@ -315,6 +320,35 @@ body.post-type-reply strong.label {
width: 60px;
}

body.post-type-forum .wp-list-table thead th a,
body.post-type-forum .wp-list-table tfoot th a,
body.post-type-topic .wp-list-table thead th a,
body.post-type-topic .wp-list-table tfoot th a,
body.post-type-reply .wp-list-table thead th a,
body.post-type-reply .wp-list-table tfoot th a {
display: flex;
}

body.post-type-forum .wp-list-table thead th:not(.sortable),
body.post-type-forum .wp-list-table tfoot th:not(.sortable),
body.post-type-forum .wp-list-table thead th a > span:first-child,
body.post-type-forum .wp-list-table tfoot th a > span:first-child,
body.post-type-forum .wp-list-table tbody td,
body.post-type-topic .wp-list-table thead th:not(.sortable),
body.post-type-topic .wp-list-table tfoot th:not(.sortable),
body.post-type-topic .wp-list-table thead th a > span:first-child,
body.post-type-topic .wp-list-table tfoot th a > span:first-child,
body.post-type-topic .wp-list-table tbody td,
body.post-type-reply .wp-list-table thead th:not(.sortable),
body.post-type-reply .wp-list-table tfoot th:not(.sortable),
body.post-type-reply .wp-list-table thead th a > span:first-child,
body.post-type-reply .wp-list-table tfoot th a > span:first-child,
body.post-type-reply .wp-list-table tbody td {
overflow-x: hidden;
text-overflow: ellipsis;
word-wrap: normal;
}

.column-bbp_forum_topic_count,
.column-bbp_forum_reply_count,
.column-bbp_topic_reply_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ class BBP_Admin {
*/
public $notices = array();

/** Components ************************************************************/

/**
* @var BBP_Forums_Admin Forums admin
*/
public $forums = null;

/**
* @var BBP_Topics_Admin Topics admin
*/
public $topics = null;

/**
* @var BBP_Replies_Admin Replies admin
*/
public $replies = null;

/**
* @var BBP_Converter Converter admin
*/
public $converter = null;

/** Functions *************************************************************/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,22 +1046,39 @@ private function count_rows_by_table( $table_name = '' ) {
* @param string $username
* @param string $password
*/
public function callback_pass( $username, $password ) {
public function callback_pass( $username = '', $password = '' ) {

// Get user – Bail if not found
$user = $this->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->users} WHERE user_login = %s AND user_pass = '' LIMIT 1", $username ) );
if ( ! empty( $user ) ) {
$usermeta = $this->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d LIMIT 1", '_bbp_password', $user->ID ) );
if ( empty( $user ) ) {
return;
}

if ( ! empty( $usermeta ) ) {
if ( $this->authenticate_pass( $password, $usermeta->meta_value ) ) {
$this->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->users} SET user_pass = %s WHERE ID = %d", wp_hash_password( $password ), $user->ID ) );
$this->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d", '_bbp_password', $user->ID ) );
// Get usermeta – Bail if not found
$usermeta = $this->get_row( $this->wpdb->prepare( "SELECT * FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d LIMIT 1", '_bbp_password', $user->ID ) );
if ( empty( $usermeta ) ) {
return;
}

// Clean the cache for this user since their password was
// upgraded from the old platform to the new.
clean_user_cache( $user->ID );
}
}
// Bail if auth fails
if ( ! $this->authenticate_pass( $password, $usermeta->meta_value ) ) {
return;
}

// Hash the password
$new_pass = wp_hash_password( $password );

// Update
$this->query( $this->wpdb->prepare( "UPDATE {$this->wpdb->users} SET user_pass = %s WHERE ID = %d", $new_pass, $user->ID ) );

// Clean up
unset( $new_pass );
$this->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d", '_bbp_password', $user->ID ) );
$this->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->usermeta} WHERE meta_key = %s AND user_id = %d", '_bbp_class', $user->ID ) );

// Clean the cache for this user since their password was
// upgraded from the old platform to the new.
clean_user_cache( $user->ID );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class BBP_Converter_DB extends wpdb {
* @param string $dbhost MySQL database host
*/
public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
register_shutdown_function( array( $this, '__destruct' ) );

if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
$this->show_errors();
Expand Down
27 changes: 21 additions & 6 deletions wp-content/plugins/bbpress/includes/admin/tools/repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,9 @@ function bbp_admin_repair_user_topic_count() {
$statement = esc_html__( 'Counting the number of topics each user has created… %s', 'bbpress' );
$result = esc_html__( 'Failed!', 'bbpress' );

$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`";
$sql_type = bbp_get_topic_post_type();
$sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'";
$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`";
$insert_rows = $bbp_db->get_results( $sql_select );

if ( is_wp_error( $insert_rows ) ) {
Expand Down Expand Up @@ -541,11 +543,13 @@ function bbp_admin_repair_user_topic_count() {
function bbp_admin_repair_user_reply_count() {

// Define variables
$bbp_db = bbp_db();
$bbp_db = bbp_db();
$statement = esc_html__( 'Counting the number of topics to which each user has replied… %s', 'bbpress' );
$result = esc_html__( 'Failed!', 'bbpress' );

$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`";
$sql_type = bbp_get_reply_post_type();
$sql_status = "'" . implode( "','", bbp_get_public_reply_statuses() ) . "'";
$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`";
$insert_rows = $bbp_db->get_results( $sql_select );

if ( is_wp_error( $insert_rows ) ) {
Expand Down Expand Up @@ -601,8 +605,11 @@ function bbp_admin_repair_user_favorites() {
return array( 1, sprintf( $statement, $result ) );
}

$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() . "'" );
$sql_type = bbp_get_topic_post_type();
$sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'";
$sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})";

$topics = $bbp_db->get_col( $sql_select );
if ( is_wp_error( $topics ) ) {
return array( 2, sprintf( $statement, $result ) );
}
Expand Down Expand Up @@ -667,7 +674,11 @@ function bbp_admin_repair_user_topic_subscriptions() {
return array( 1, sprintf( $statement, $result ) );
}

$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() . "'" );
$sql_type = bbp_get_topic_post_type();
$sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'";
$sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})";

$topics = $bbp_db->get_col( $sql_select );
if ( is_wp_error( $topics ) ) {
return array( 2, sprintf( $statement, $result ) );
}
Expand Down Expand Up @@ -732,7 +743,11 @@ function bbp_admin_repair_user_forum_subscriptions() {
return array( 1, sprintf( $statement, $result ) );
}

$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() . "'" );
$sql_type = bbp_get_forum_post_type();
$sql_status = "'" . implode( "','", bbp_get_public_forum_statuses() ) . "'";
$sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})";

$forums = $bbp_db->get_col( $sql_select );
if ( is_wp_error( $forums ) ) {
return array( 2, sprintf( $statement, $result ) );
}
Expand Down
Loading

0 comments on commit 173f056

Please sign in to comment.