Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
539 views
in Q2A Core by
How do I allocate questions asked on Forum to Expert by Category ?
Q2A version: Latest

1 Answer

0 votes
by

test the plugin : qa-category-email-notifications-event.php

you have the sql request on line 55 ; it's not so hard to add conditions if you want to restrict it to experts.

ie , replace

                return array(
                        'columns' => array('^users.email'),
                        'source' => "^users JOIN ^userfavorites ON ^userfavorites.userid=^users.userid WHERE ^userfavorites.entityid=$ AND ^userfavorites.entitytype=$",
                        'arguments' => array($categoryid, QA_ENTITY_CATEGORY),
                        'sortasc' => 'title',
                );

by

                return array(
                        'columns' => array('^users.email'),
                        'source' => "^users JOIN ^userfavorites ON ^userfavorites.userid=^users.userid ".
                                        " inner join ^userlevels on ^userlevels.userid=^users.userid".
                                        " WHERE ^userfavorites.entityid=$ AND ^userfavorites.entitytype=$".
                                        " and ^userlevels.entityid=$ and ^userlevels.entitytype=$ and ^userlevels.level>=$" ,
                        'arguments' => array($categoryid, QA_ENTITY_CATEGORY,$categoryid, QA_ENTITY_CATEGORY,QA_USER_LEVEL_EXPERT),
                        'sortasc' => 'title',
                );

 

** the request can be optimized but it is the minimal modification to get the result

** if you need experts only, change "^userlevels.level>=$" by "^userlevels.level=$"

 

...