Tushar Sharma
asked 5 years ago

I’ve been unable to get question status filter to work, even if questions are available, it shows

Sorry, but nothing matched your filter. You can ask question here

unless I select All

I earlier had similar problem with question category filter, which I tracked down to code for restricting user access to dashboard – it was somehow messing up with AJAX. I changed that code, and even disabled it this time, but nothing seems to work.
I also made some changes in question-list.php but removing them doesn’t seem to fix the problem either.

If anyone has faced similar problems in past, please share your experience, and help me track down the problem.

replied 5 years ago

It now appears to be working, but I still don’t understand which questions fall in ‘Answered’ category.

dominic Staff
replied 5 years ago

You can try this to fix this problem : open Inc/filter.php: go to Line 400
in case replied you add this :

$args['meta_query'][] = array(
     'key' => '_dwqa_status',
     'value' => array( 'answered' ),
     'compare' => 'IN',

Hope this helps !

2 Answers
answered 5 years ago

I need to debug directly on your site, please PM me url, admin and ftp credentials of your site. Regards,

replied 5 years ago

I am unable to find an option to send a PM. Should I write a private answer?

dominic Staff
replied 5 years ago

Of course, please use the private answer: http://prntscr.com/7o96av

Tushar Sharma
answered 5 years ago

This is the SQL query I obtain, and even though relevant rows are present in database, running this query yields nothing.

SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1  AND ( 
  ( wp_postmeta.meta_key = '_dwqa_status' AND CAST(wp_postmeta.meta_value AS CHAR) IN ('answered') )
) AND wp_posts.post_type = 'dwqa-question' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'pending') OR (wp_posts.post_author = 4 AND (wp_posts.post_status = 'private'))) AND ID IN (SELECT `dw_latest_answer_date`.question
            FROM `wp_posts`, 
                ( SELECT `wp_postmeta`.meta_value as question, max( `wp_posts`.post_date) as post_date 
                    FROM `wp_posts`, `wp_postmeta` 
                    WHERE `wp_posts`.post_type = 'dwqa-answer' 
                    AND ( `wp_posts`.post_status = 'publish'
                        OR `wp_posts`.post_status = 'private' ) 
                    AND `wp_postmeta`.post_id = `wp_posts`.ID 
                    AND `wp_postmeta`.meta_key = '_question' 
                    GROUP BY question ) AS dw_latest_answer_date,

            WHERE `wp_posts`.post_status = 'publish' 
            AND `wp_posts`.post_type = 'dwqa-answer' 
            AND `wp_posts`.post_date = `dw_latest_answer_date`.post_date
            AND `wp_users`.ID = `wp_posts`.post_author
            AND `wp_usermeta`.user_id = `wp_users`.ID
            AND `wp_usermeta`.meta_key = 'wp_capabilities'
            AND ( 
                `wp_usermeta`.meta_value LIKE '%administrator%' 
                OR `wp_usermeta`.meta_value LIKE '%editor%' 
                OR `wp_usermeta`.meta_value LIKE '%author%' 
            ) ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_modified DESC LIMIT 0, 10
replied 5 years ago

Actually, ignore that, even the query obtained for ‘open’ posts doesn’t yield.

replied 5 years ago

After patching the code on live site, some of the ‘answered’ answers appear, others don’t. I am clueless.

replied 5 years ago

Sorry for so many replies. Perhaps I’m a little sleepy.
The SQL query for ‘open’ answers really works, but the one for ‘answered’ answers doesn’t.

dominic Staff
replied 5 years ago

I have checked on our demo and see that it’s Filter bug from our plugin, we will check and fix it as soon as possible. Sorry about that, my friend.

Powered by DW Question & Answer Pro