Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
gordielachance authored and gordielachance committed Sep 17, 2016
1 parent 2d3d3ec commit c3bc8a0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions bbpress-pencil-unread.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,8 @@ function new_reply_backend($post_id){
if ( !current_user_can( $post_obj->cap->edit_post, $post_id ) ) return $post_id;

$reply_id = bbp_get_reply_id($post_id);

if (isset($_POST['post_parent'])) $topic_id = bbp_get_topic_id($_POST['post_parent']);
if (isset($_POST['bbp_forum_id'])) $forum_id = bbp_get_forum_id($_POST['bbp_forum_id']);
$topic_id = (isset($_POST['post_parent'])) ? bbp_get_topic_id($_POST['post_parent']) : null;
$forum_id = (isset($_POST['bbp_forum_id'])) ? bbp_get_forum_id($_POST['bbp_forum_id']) : null;

$this->new_reply($reply_id,$topic_id,$forum_id);
}
Expand Down Expand Up @@ -523,9 +522,9 @@ function has_user_read_all_forum_topics( $forum_id,$user_id=false ){
$topics_args = array(
'post_type' => bbp_get_topic_post_type(),
'post_parent' => $forum_id,
'fields' => 'ids',
'posts_per_page' => -1,
//optimize query :
'fields' => 'ids',
'no_found_rows' => true, //https://wpartisan.me/tutorials/wordpress-database-queries-speed-sql_calc_found_rows
'update_post_term_cache' => false, // grabs post terms
'update_post_meta_cache' => true // grabs post meta (here needed)
Expand Down Expand Up @@ -700,9 +699,6 @@ function has_user_read($post_id,$user_id=false){

}

self::debug_log('check in forums '.implode(',',$check_forums));


//look for an unread forum
$has_read = true;
foreach($check_forums as $forum_id){
Expand Down

0 comments on commit c3bc8a0

Please sign in to comment.