compatibility with bbPress
-
Hello I find some bag in this plugin, then use them with bbPress. Topics in forum doesn’t show for users.
The problem is in method parseQuery, then this method add ‘post__not_in’ SQL is:SELECT hp_posts . * FROM hp_posts WHERE 1 =1 AND hp_posts.ID NOT IN ( 56, 527, 714) AND hp_posts.post_parent =1072 AND hp_posts.post_type IN ( 'topic', 'reply' ) AND ( hp_posts.post_status = 'publish' OR hp_posts.post_status = 'closed' OR hp_posts.post_author =30 AND hp_posts.post_status = 'private' OR hp_posts.post_author =30 AND hp_posts.post_status = 'hidden' ) AND hp_posts.ID NOT IN ( 56, 527, 714) ORDER BY hp_posts.post_date ASC LIMIT 0 , 30
But if method doesn’t add ‘post__not_in’, then allrigth and sql is:
SELECT hp_posts . * FROM hp_posts WHERE 1 =1 AND (hp_posts.ID =1072 OR hp_posts.post_parent =1072) AND hp_posts.post_type IN ( 'topic', 'reply' ) AND ( hp_posts.post_status = 'publish' OR hp_posts.post_status = 'closed' OR hp_posts.post_author =30 AND hp_posts.post_status = 'private' OR hp_posts.post_author =30 AND hp_posts.post_status = 'hidden' ) AND hp_posts.ID NOT IN ( 56, 527, 714 ) ORDER BY hp_posts.post_date ASC LIMIT 0 , 30
The problem is in:
BAD:AND hp_posts.ID NOT IN ( 56, 527, 714) AND hp_posts.post_parent =1072
CORRECT:
AND (hp_posts.ID =1072 OR hp_posts.post_parent =1072) AND hp_posts.post_type
Then plugin add ‘post__not_in’, SQL query has no (OR hp_posts.post_parent =1072) and this post doen’t select.
SOLUTION
change
add_filter('parse_query', array($oUserAccessManager, 'parseQuery'));
toadd_filter('posts_where', array($oUserAccessManager, 'posts_where')); public function posts_where($where) { $aUamOptions = $this->getAdminOptions(); if ($aUamOptions['hide_post'] == 'true') { $oUamAccessHandler = $this->getAccessHandler(); $aExcludedPosts = $oUamAccessHandler->getExcludedPosts(); if (count($aExcludedPosts) > 0) { $notIN = implode(',', $aExcludedPosts); $where .= " AND hp_posts.ID NOT IN ($notIN)"; } } return $where; }
Thanks u for good plugin
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘compatibility with bbPress’ is closed to new replies.