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 c3bc8a0 commit 0ddd681
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bbpress-pencil-unread.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ function get_forum_id_for_post($post_id = null){
}

function has_user_read_all_forum_topics( $forum_id,$user_id=false ){

//check : http://wordpress.stackexchange.com/questions/239603/how-to-speed-up-a-complex-wp-query

if(!$user_id) $user_id = get_current_user_id();
if(!$user_id) return true;
Expand Down Expand Up @@ -532,6 +534,8 @@ function has_user_read_all_forum_topics( $forum_id,$user_id=false ){

if ( $skip_timestamp = $this->get_skip_timestamp($user_id,$forum_id) ){
$skip_time = date_i18n( 'Y-m-d H:i:s', $skip_timestamp ); //mysql format
//TO FIX should we query the 'post_date' field instead of this; which slows down the query ?
//We must be sure it has the same value than '_bbp_last_active_time' postmeta.
$topics_args['meta_query'][] = array(
'key' => '_bbp_last_active_time',
'value' => $skip_time,
Expand Down

0 comments on commit 0ddd681

Please sign in to comment.