@@ -512,7 +525,7 @@ function bbp_admin_repair_user_topic_count() {
$insert_values[] = "('{$insert_row->post_author}', '{$key}', '{$insert_row->_count}')";
}
- if ( !count( $insert_values ) ) {
+ if ( ! count( $insert_values ) ) {
return array( 2, sprintf( $statement, $result ) );
}
@@ -562,7 +575,7 @@ function bbp_admin_repair_user_reply_count() {
$insert_values[] = "('{$insert_row->post_author}', '{$key}', '{$insert_row->_count}')";
}
- if ( !count( $insert_values ) ) {
+ if ( ! count( $insert_values ) ) {
return array( 2, sprintf( $statement, $result ) );
}
@@ -632,7 +645,7 @@ function bbp_admin_repair_user_favorites() {
unset( $favorites, $favorites_joined );
}
- if ( !count( $values ) ) {
+ if ( ! count( $values ) ) {
$result = esc_html__( 'Nothing to remove!', 'bbpress' );
return array( 0, sprintf( $statement, $result ) );
}
@@ -701,7 +714,7 @@ function bbp_admin_repair_user_topic_subscriptions() {
unset( $subscriptions, $subscriptions_joined );
}
- if ( !count( $values ) ) {
+ if ( ! count( $values ) ) {
$result = esc_html__( 'Nothing to remove!', 'bbpress' );
return array( 0, sprintf( $statement, $result ) );
}
@@ -770,7 +783,7 @@ function bbp_admin_repair_user_forum_subscriptions() {
unset( $subscriptions, $subscriptions_joined );
}
- if ( !count( $values ) ) {
+ if ( ! count( $values ) ) {
$result = esc_html__( 'Nothing to remove!', 'bbpress' );
return array( 0, sprintf( $statement, $result ) );
}
diff --git a/src/includes/admin/tools/upgrade.php b/src/includes/admin/tools/upgrade.php
index 9e9a89492..07c5088c1 100644
--- a/src/includes/admin/tools/upgrade.php
+++ b/src/includes/admin/tools/upgrade.php
@@ -82,17 +82,30 @@ function bbp_admin_upgrade_page() {
@@ -122,7 +135,7 @@ function bbp_admin_upgrade_page() {
// Optional description
if ( ! empty( $item['description'] ) ) :
- echo '
' . esc_html( $item['description'] ) . '
' . esc_html( $item['description'] ) . '
diff --git a/src/includes/admin/topics.php b/src/includes/admin/topics.php
index def70dd2d..5e3640276 100644
--- a/src/includes/admin/topics.php
+++ b/src/includes/admin/topics.php
@@ -621,13 +621,13 @@ public function toggle_topic() {
$is_super = ( false === $is_sticky ) && ! empty( $_GET['super'] ) && ( '1' === $_GET['super'] )
? true
: false;
- $message = ( true === $is_sticky )
+ $message = ( true === $is_sticky )
? 'unstuck'
: 'stuck';
- $message = ( true === $is_super )
+ $message = ( true === $is_super )
? 'super_sticky'
: $message;
- $success = ( true === $is_sticky )
+ $success = ( true === $is_sticky )
? bbp_unstick_topic( $topic_id )
: bbp_stick_topic( $topic_id, $is_super );
diff --git a/src/includes/common/classes.php b/src/includes/common/classes.php
index 1ea2b81a9..33ed7bd02 100644
--- a/src/includes/common/classes.php
+++ b/src/includes/common/classes.php
@@ -222,7 +222,7 @@ public function start_el( &$output, $object, $depth = 0, $args = array(), $curre
// - the post type is a forum
// - the forum is a category
// - forum is closed
- if ( ( true === $args['disable_categories'] )
+ if ( ( true === $args['disable_categories'] )
&& ( bbp_get_forum_post_type() === $object->post_type )
&& ( bbp_is_forum_category( $object->ID )
|| ( ! current_user_can( 'edit_forum', $object->ID ) && bbp_is_forum_closed( $object->ID )
diff --git a/src/includes/common/engagements.php b/src/includes/common/engagements.php
index 0263c3ffb..2f6951390 100644
--- a/src/includes/common/engagements.php
+++ b/src/includes/common/engagements.php
@@ -278,21 +278,25 @@ public function get_query( $args = array(), $context_key = '', $meta_key = '', $
// Backwards compat for pre-2.6.0
if ( is_numeric( $args ) ) {
$args = array(
- 'meta_query' => array( array(
- 'key' => $meta_key,
- 'value' => bbp_get_user_id( $args, false, false ),
- 'compare' => 'NUMERIC'
- ) )
+ 'meta_query' => array(
+ array(
+ 'key' => $meta_key,
+ 'value' => bbp_get_user_id( $args, false, false ),
+ 'compare' => 'NUMERIC'
+ )
+ )
);
}
// Default arguments
$defaults = array(
- 'meta_query' => array( array(
- 'key' => $meta_key,
- 'value' => bbp_get_displayed_user_id(),
- 'compare' => 'NUMERIC'
- ) )
+ 'meta_query' => array(
+ array(
+ 'key' => $meta_key,
+ 'value' => bbp_get_displayed_user_id(),
+ 'compare' => 'NUMERIC'
+ )
+ )
);
// Parse arguments
@@ -502,21 +506,25 @@ public function get_query( $args = array(), $context_key = '', $meta_key = '', $
// Backwards compat for pre-2.6.0
if ( is_numeric( $args ) ) {
$args = array(
- 'tax_query' => array( array(
- 'taxonomy' => $tax_key,
- 'terms' => $user_key . bbp_get_user_id( $args, false, false ),
- 'field' => 'slug'
- ) )
+ 'tax_query' => array(
+ array(
+ 'taxonomy' => $tax_key,
+ 'terms' => $user_key . bbp_get_user_id( $args, false, false ),
+ 'field' => 'slug'
+ )
+ )
);
}
// Default arguments
$defaults = array(
- 'tax_query' => array( array(
- 'taxonomy' => $tax_key,
- 'terms' => $user_key . bbp_get_displayed_user_id(),
- 'field' => 'slug'
- ) )
+ 'tax_query' => array(
+ array(
+ 'taxonomy' => $tax_key,
+ 'terms' => $user_key . bbp_get_displayed_user_id(),
+ 'field' => 'slug'
+ )
+ )
);
// Parse arguments
diff --git a/src/includes/common/formatting.php b/src/includes/common/formatting.php
index 0f9ff4f1f..27cee730b 100644
--- a/src/includes/common/formatting.php
+++ b/src/includes/common/formatting.php
@@ -214,7 +214,7 @@ function bbp_encode_callback( $matches = array() ) {
$content = '
' . $content . '
';
// Wrap blocks in pre tags
- if ('`' !== $matches[1] ) {
+ if ( '`' !== $matches[1] ) {
$content = "\n
" . $content . "
\n";
}
diff --git a/src/includes/common/functions.php b/src/includes/common/functions.php
index 41673a74f..00d60b178 100644
--- a/src/includes/common/functions.php
+++ b/src/includes/common/functions.php
@@ -590,8 +590,8 @@ function bbp_filter_anonymous_post_data( $args = array() ) {
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
- 'bbp_anonymous_name' => ! empty( $_POST['bbp_anonymous_name'] ) ? $_POST['bbp_anonymous_name'] : false,
- 'bbp_anonymous_email' => ! empty( $_POST['bbp_anonymous_email'] ) ? $_POST['bbp_anonymous_email'] : false,
+ 'bbp_anonymous_name' => ! empty( $_POST['bbp_anonymous_name'] ) ? $_POST['bbp_anonymous_name'] : false,
+ 'bbp_anonymous_email' => ! empty( $_POST['bbp_anonymous_email'] ) ? $_POST['bbp_anonymous_email'] : false,
'bbp_anonymous_website' => ! empty( $_POST['bbp_anonymous_website'] ) ? $_POST['bbp_anonymous_website'] : false,
), 'filter_anonymous_post_data' );
@@ -741,10 +741,17 @@ function bbp_check_for_duplicate( $post_data = array() ) {
if ( ! empty( $email ) && is_email( $email ) ) {
// Get the meta SQL
- $clauses = get_meta_sql( array( array(
- 'key' => '_bbp_anonymous_email',
- 'value' => $email,
- ) ), 'post', $bbp_db->posts, 'ID' );
+ $clauses = get_meta_sql(
+ array(
+ array(
+ 'key' => '_bbp_anonymous_email',
+ 'value' => $email,
+ )
+ ),
+ 'post',
+ $bbp_db->posts,
+ 'ID'
+ );
// Set clauses
$join = $clauses['join'];
@@ -2386,12 +2393,14 @@ function bbp_request_feed_trap( $query_vars = array() ) {
), $select_query_vars ) );
// Restrict to specific forum ID
- $meta_query = array( array(
- 'key' => '_bbp_forum_id',
- 'value' => bbp_get_forum_id(),
- 'type' => 'NUMERIC',
- 'compare' => '='
- ) );
+ $meta_query = array(
+ array(
+ 'key' => '_bbp_forum_id',
+ 'value' => bbp_get_forum_id(),
+ 'type' => 'NUMERIC',
+ 'compare' => '='
+ )
+ );
}
// Only forum replies
diff --git a/src/includes/common/locale.php b/src/includes/common/locale.php
index d0ec3e41d..d761d9a8f 100644
--- a/src/includes/common/locale.php
+++ b/src/includes/common/locale.php
@@ -30,7 +30,9 @@
* @return string Translated role name on success, original name on failure.
*/
function bbp_translate_user_role( $name ) {
- return translate_with_gettext_context( before_last_bar( $name ), 'User role', 'bbpress' );
+ // WordPress.WP.I18n.NoEmptyStrings
+ // -- empty string is intentional here as actual content comes from database
+ return _x( before_last_bar( $name ), 'User role', 'bbpress' ); // phpcs:ignore
}
/**
diff --git a/src/includes/common/locks.php b/src/includes/common/locks.php
index 49558e868..253c958b7 100644
--- a/src/includes/common/locks.php
+++ b/src/includes/common/locks.php
@@ -23,12 +23,12 @@
function bbp_check_post_lock( $post_id = 0 ) {
// Bail if no post
- if ( !$post = get_post( $post_id ) ) {
+ if ( ! $post = get_post( $post_id ) ) {
return false;
}
// Bail if no lock
- if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
+ if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
return false;
}
@@ -62,7 +62,7 @@ function bbp_check_post_lock( $post_id = 0 ) {
function bbp_set_post_lock( $post_id = 0 ) {
// Bail if no post
- if ( !$post = get_post( $post_id ) ) {
+ if ( ! $post = get_post( $post_id ) ) {
return false;
}
diff --git a/src/includes/common/shortcodes.php b/src/includes/common/shortcodes.php
index 6114d0eda..5d9fbb5ed 100644
--- a/src/includes/common/shortcodes.php
+++ b/src/includes/common/shortcodes.php
@@ -846,11 +846,13 @@ public function display_topic_index_query( $args = array() ) {
* @return array
*/
public function display_topics_of_tag_query( $args = array() ) {
- $args['tax_query'] = array( array(
- 'taxonomy' => bbp_get_topic_tag_tax_id(),
- 'field' => 'id',
- 'terms' => bbpress()->current_topic_tag_id
- ) );
+ $args['tax_query'] = array(
+ array(
+ 'taxonomy' => bbp_get_topic_tag_tax_id(),
+ 'field' => 'id',
+ 'terms' => bbpress()->current_topic_tag_id
+ )
+ );
return $args;
}
diff --git a/src/includes/common/widgets.php b/src/includes/common/widgets.php
index ca37562cd..8c6846bc3 100644
--- a/src/includes/common/widgets.php
+++ b/src/includes/common/widgets.php
@@ -695,10 +695,12 @@ public function widget( $args = array(), $instance = array() ) {
'post_status' => bbp_get_public_topic_statuses(),
'post_parent' => $settings['parent_forum'],
'posts_per_page' => (int) $settings['max_shown'],
- 'meta_query' => array( array(
- 'key' => '_bbp_last_active_time',
- 'type' => 'DATETIME'
- ) ),
+ 'meta_query' => array(
+ array(
+ 'key' => '_bbp_last_active_time',
+ 'type' => 'DATETIME'
+ )
+ ),
// Ordering
'orderby' => 'meta_value',
@@ -721,10 +723,12 @@ public function widget( $args = array(), $instance = array() ) {
'post_status' => bbp_get_public_topic_statuses(),
'post_parent' => $settings['parent_forum'],
'posts_per_page' => (int) $settings['max_shown'],
- 'meta_query' => array( array(
- 'key' => '_bbp_reply_count',
- 'type' => 'NUMERIC'
- ) ),
+ 'meta_query' => array(
+ array(
+ 'key' => '_bbp_reply_count',
+ 'type' => 'NUMERIC'
+ )
+ ),
// Ordering
'orderby' => 'meta_value_num',
diff --git a/src/includes/core/template-loader.php b/src/includes/core/template-loader.php
index 10deea78b..6bc3c12a5 100644
--- a/src/includes/core/template-loader.php
+++ b/src/includes/core/template-loader.php
@@ -32,58 +32,58 @@ function bbp_template_include_theme_supports( $template = '' ) {
if ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template() ) ) : //phpcs:ignore
// User favorites
- elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template() ) ) :
+ elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template() ) ) :
// User favorites
- elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template() ) ) :
+ elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template() ) ) :
// Viewing a user
- elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) :
+ elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) :
// Single View
- elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) :
+ elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) :
// Search
- elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) :
+ elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) :
// Forum edit
- elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) :
+ elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) :
// Single Forum
- elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template() ) ) :
+ elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template() ) ) :
// Forum Archive
- elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template() ) ) :
+ elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template() ) ) :
// Topic merge
- elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) :
+ elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) :
// Topic split
- elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) :
+ elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) :
// Topic edit
- elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) :
+ elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) :
// Single Topic
- elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template() ) ) :
+ elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template() ) ) :
// Topic Archive
- elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) :
+ elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) :
// Reply move
- elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) :
+ elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) :
// Editing a reply
- elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) :
+ elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) :
// Single Reply
- elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template() ) ) :
+ elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template() ) ) :
// Editing a topic tag
- elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) :
+ elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) :
// Viewing a topic tag
- elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) :
+ elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) :
endif;
// A bbPress template file was located, so override the WordPress template
diff --git a/src/includes/extend/buddypress/groups.php b/src/includes/extend/buddypress/groups.php
index 147486dee..af30ae6ca 100644
--- a/src/includes/extend/buddypress/groups.php
+++ b/src/includes/extend/buddypress/groups.php
@@ -654,7 +654,7 @@ public function group_admin_ui_display_metabox( $item ) {
public function create_screen( $group_id = 0 ) {
// Bail if not looking at this screen
- if ( !bp_is_group_creation_step( $this->slug ) ) {
+ if ( ! bp_is_group_creation_step( $this->slug ) ) {
return false;
}
diff --git a/src/includes/extend/buddypress/loader.php b/src/includes/extend/buddypress/loader.php
index 1e0d59eba..ed88dbe2d 100644
--- a/src/includes/extend/buddypress/loader.php
+++ b/src/includes/extend/buddypress/loader.php
@@ -177,7 +177,7 @@ private function fully_loaded() {
public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
// Stop if there is no user displayed or logged in
- if ( ! is_user_logged_in() && !bp_displayed_user_id() ) {
+ if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) {
return;
}
diff --git a/src/includes/forums/functions.php b/src/includes/forums/functions.php
index fa54e9d89..5407b3616 100644
--- a/src/includes/forums/functions.php
+++ b/src/includes/forums/functions.php
@@ -604,7 +604,7 @@ function bbp_edit_forum_handler( $action = '' ) {
} else {
$append_error = ( is_wp_error( $forum_id ) && $forum_id->get_error_message() ) ? $forum_id->get_error_message() . ' ' : '';
- bbp_add_error( 'bbp_forum_error', __( '
Error: The following problem(s) have been found with your forum:' . $append_error . 'Please try again.', 'bbpress' ) );
+ bbp_add_error( 'bbp_forum_error', sprintf( __( '
Error: The following problem(s) have been found with your forum: %s Please try again.', 'bbpress' ) ), $append_error );
}
}
@@ -1094,7 +1094,7 @@ function bbp_bump_forum_topic_count( $forum_id = 0, $difference = 1, $update_anc
$difference = (int) $difference;
// Update this forum id
- update_post_meta( $forum_id, '_bbp_topic_count', (int) ( $topic_count + $difference ) );
+ update_post_meta( $forum_id, '_bbp_topic_count', (int) ( $topic_count + $difference ) );
update_post_meta( $forum_id, '_bbp_total_topic_count', (int) ( $total_topic_count + $difference ) );
// Check for ancestors
@@ -1216,7 +1216,7 @@ function bbp_bump_forum_topic_count_hidden( $forum_id = 0, $difference = 1, $upd
$difference = (int) $difference;
// Update this forum id
- update_post_meta( $forum_id, '_bbp_topic_count_hidden', (int) ( $reply_count + $difference ) );
+ update_post_meta( $forum_id, '_bbp_topic_count_hidden', (int) ( $reply_count + $difference ) );
update_post_meta( $forum_id, '_bbp_total_topic_count_hidden', (int) ( $total_topic_count + $difference ) );
// Check for ancestors
@@ -1339,7 +1339,7 @@ function bbp_bump_forum_reply_count( $forum_id = 0, $difference = 1, $update_anc
$difference = (int) $difference;
// Update this forum id
- update_post_meta( $forum_id, '_bbp_reply_count', (int) ( $reply_count + $difference ) );
+ update_post_meta( $forum_id, '_bbp_reply_count', (int) ( $reply_count + $difference ) );
update_post_meta( $forum_id, '_bbp_total_reply_count', (int) ( $total_reply_count + $difference ) );
// Check for ancestors
@@ -1398,7 +1398,7 @@ function bbp_bump_forum_reply_count_hidden( $forum_id = 0, $difference = 1, $upd
$difference = (int) $difference;
// Update this forum id
- update_post_meta( $forum_id, '_bbp_reply_count_hidden', (int) ( $reply_count + $difference ) );
+ update_post_meta( $forum_id, '_bbp_reply_count_hidden', (int) ( $reply_count + $difference ) );
update_post_meta( $forum_id, '_bbp_total_reply_count_hidden', (int) ( $total_reply_count + $difference ) );
// Check for ancestors
diff --git a/src/includes/replies/functions.php b/src/includes/replies/functions.php
index 220d6380c..53e05a702 100644
--- a/src/includes/replies/functions.php
+++ b/src/includes/replies/functions.php
@@ -789,7 +789,7 @@ function bbp_edit_reply_handler( $action = '' ) {
} else {
$append_error = ( is_wp_error( $reply_id ) && $reply_id->get_error_message() ) ? $reply_id->get_error_message() . ' ' : '';
- bbp_add_error( 'bbp_reply_error', __( '
Error: The following problem(s) have been found with your reply:' . $append_error . 'Please try again.', 'bbpress' ) );
+ bbp_add_error( 'bbp_reply_error', sprintf( __( '
Error: The following problem(s) have been found with your reply: %s. Please try again.', 'bbpress' ) ), $append_error );
}
}
diff --git a/src/includes/replies/template.php b/src/includes/replies/template.php
index 7ddbf7113..f47aa427c 100644
--- a/src/includes/replies/template.php
+++ b/src/includes/replies/template.php
@@ -1001,7 +1001,7 @@ function bbp_is_reply_anonymous( $reply_id = 0 ) {
* @param int $reply_id Optional. Reply id
*/
function bbp_reply_author( $reply_id = 0 ) {
- echo bbp_get_reply_author( $reply_id );
+ echo bbp_get_reply_author_display_name( $reply_id );
}
/**
* Deprecated. Use bbp_get_reply_author_display_name() instead.
@@ -1101,7 +1101,7 @@ function bbp_get_reply_author_display_name( $reply_id = 0 ) {
// Encode possible UTF8 display names
if ( seems_utf8( $author_name ) === false ) {
- $author_name = utf8_encode( $author_name );
+ $author_name = mb_convert_encoding( $author_name, 'UTF-8', mb_detect_encoding( $author_name ) );
}
// Filter & return
@@ -2304,7 +2304,7 @@ function bbp_get_reply_class( $reply_id = 0, $classes = array() ) {
function bbp_get_replies_pagination_base( $topic_id = 0 ) {
// If pretty permalinks are enabled, make our pagination pretty
- if ( bbp_use_pretty_urls() && ! bbp_is_topic_pending( $topic_id )) {
+ if ( bbp_use_pretty_urls() && ! bbp_is_topic_pending( $topic_id ) ) {
// User's replies
if ( bbp_is_single_user_replies() ) {
diff --git a/src/includes/search/template.php b/src/includes/search/template.php
index cb67cf5d4..9d7398ecf 100644
--- a/src/includes/search/template.php
+++ b/src/includes/search/template.php
@@ -297,7 +297,7 @@ function bbp_get_search_terms( $passed_terms = '' ) {
$search_terms = get_query_var( bbp_get_search_rewrite_id(), null );
// Searching globally
- if ( ! is_null( $search_terms ) ) {
+ if ( ! is_null( $search_terms ) ) {
$search_terms = wp_unslash( $search_terms );
// Other searches
diff --git a/src/includes/topics/functions.php b/src/includes/topics/functions.php
index 823b6acf7..e2ffe8062 100644
--- a/src/includes/topics/functions.php
+++ b/src/includes/topics/functions.php
@@ -727,7 +727,7 @@ function bbp_edit_topic_handler( $action = '' ) {
} else {
$append_error = ( is_wp_error( $topic_id ) && $topic_id->get_error_message() ) ? $topic_id->get_error_message() . ' ' : '';
- bbp_add_error( 'bbp_topic_error', __( '
Error: The following problem(s) have been found with your topic:' . $append_error . 'Please try again.', 'bbpress' ) );
+ bbp_add_error( 'bbp_topic_error', sprintf( esc_html_e( '
Error: The following problem(s) have been found with your topic: %s. Please try again.', 'bbpress' ) ), $append_error );
}
}
@@ -1742,7 +1742,7 @@ function bbp_edit_topic_tag_handler( $action = '' ) {
}
// Attempt to update the tag
- $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : '';
+ $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : '';
$description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : '';
$tag = wp_update_term( $tag_id, bbp_get_topic_tag_tax_id(), array(
'name' => $name,
@@ -3819,7 +3819,7 @@ function bbp_display_topics_feed_rss2( $topics_query = array() ) {
-
+
found_posts = (int) $query->found_posts + (int) $sticky_count;
- $query->post_count = (int) $query->post_count + (int) $sticky_count;
+ $query->post_count = (int) $query->post_count + (int) $sticky_count;
}
}
diff --git a/src/includes/users/engagements.php b/src/includes/users/engagements.php
index e18c58d55..3dd81861d 100644
--- a/src/includes/users/engagements.php
+++ b/src/includes/users/engagements.php
@@ -956,20 +956,21 @@ function bbp_get_user_object_ids( $args = array() ) {
'fields' => 'ids',
'post_type' => $r['object_type'],
'posts_per_page' => -1,
- 'meta_query' => array( array(
- 'key' => $r['rel_key'],
- 'value' => $r['user_id'],
- 'compare' => 'NUMERIC'
- ),
-
- // Performance
- 'nopaging' => true,
- 'suppress_filters' => true,
- 'update_post_term_cache' => false,
- 'update_post_meta_cache' => false,
- 'ignore_sticky_posts' => true,
- 'no_found_rows' => true
- ) );
+ 'meta_query' => array(
+ array(
+ 'key' => $r['rel_key'],
+ 'value' => $r['user_id'],
+ 'compare' => 'NUMERIC'
+ ),
+ // Performance
+ 'nopaging' => true,
+ 'suppress_filters' => true,
+ 'update_post_term_cache' => false,
+ 'update_post_meta_cache' => false,
+ 'ignore_sticky_posts' => true,
+ 'no_found_rows' => true
+ )
+ );
}
// Parse arguments
diff --git a/src/templates/default/bbpress-functions.php b/src/templates/default/bbpress-functions.php
index 6488322ea..275c76af3 100644
--- a/src/templates/default/bbpress-functions.php
+++ b/src/templates/default/bbpress-functions.php
@@ -240,7 +240,7 @@ public function ajax_favorite() {
// Get user and topic data
$user_id = bbp_get_current_user_id();
- $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
+ $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
$type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post';
// Bail if user cannot add favorites for this user
@@ -266,7 +266,7 @@ public function ajax_favorite() {
// Take action
$status = bbp_is_user_favorite( $user_id, $object->ID )
? bbp_remove_user_favorite( $user_id, $object->ID )
- : bbp_add_user_favorite( $user_id, $object->ID );
+ : bbp_add_user_favorite( $user_id, $object->ID );
// Bail if action failed
if ( empty( $status ) ) {
@@ -303,7 +303,7 @@ public function ajax_subscription() {
// Get user and topic data
$user_id = bbp_get_current_user_id();
- $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
+ $id = ! empty( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
$type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post';
// Bail if user cannot add favorites for this user
@@ -329,7 +329,7 @@ public function ajax_subscription() {
// Take action
$status = bbp_is_user_subscribed( $user_id, $object->ID )
? bbp_remove_user_subscription( $user_id, $object->ID )
- : bbp_add_user_subscription( $user_id, $object->ID );
+ : bbp_add_user_subscription( $user_id, $object->ID );
// Bail if action failed
if ( empty( $status ) ) {
@@ -353,4 +353,5 @@ public function ajax_subscription() {
}
}
new BBP_Default();
-endif;
+
+endif; // class_exists check