Made through sql_where:
Code: Select all
$forums_id_ary = array("1","2","3");
$event['sql_where'] = " t.forum_id IN (" . $forums_id_ary . ") ";
GitHub: main_listener.php
Code: Select all
$forums_id_ary = array("1","2","3");
$event['sql_where'] = " t.forum_id IN (" . $forums_id_ary . ") ";
sql_where
value instead of overwriting it. Also you should be using $db->sql_in_set()
:Code: Select all
$event['sql_where'] .= ' AND ' . $this->db->sql_in_set('t.forum_id', $forums_id_ary);
Not working.kasimi wrote: ↑Mon May 07, 2018 8:38 pm Try appending to the existingsql_where
value instead of overwriting it. Also you should be using$db->sql_in_set()
:
Code: Select all
$event['sql_where'] .= ' AND ' . $this->db->sql_in_set('t.forum_id', $forums_id_ary);
Code: Select all
SELECT t.*, f.forum_id, f.forum_name, tp.topic_posted, tt.mark_time, ft.mark_time as f_mark_time FROM for_topics t LEFT JOIN for_forums f ON (f.forum_id = t.forum_id) LEFT JOIN for_topics_posted tp ON (tp.user_id = 2 AND t.topic_id = tp.topic_id) LEFT JOIN for_topics_track tt ON (tt.user_id = 2 AND t.topic_id = tt.topic_id) LEFT JOIN for_forums_track ft ON (ft.user_id = 2 AND ft.forum_id = f.forum_id) WHERE t.topic_id IN (24, 23, 22, 5, 21, 20, 19, 30, 25, 26, 27, 28, 29, 31, 11, 10, 9, 8, 7, 32, 4, 33, 34, 18, 17) AND ((1=1 AND t.topic_visibility = 1) OR t.forum_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) AND t.forum_id = '2,3,4,6' ORDER BY t.topic_last_post_time DESC
public function search_newpost_filter($event)
as it is now, github is not updated.f.forum_id
instead of t.forum_id
Code: Select all
$event['sql_where'] .= ' AND ' . $this->db->sql_in_set('f.forum_id', $forums_id_ary);
AND t.forum_id = '2,3,4,6'
which is not correct.Code: Select all
public function search_newpost_filter($event)
{
$forums_id = $this->user->data['user_newpost_filter'];
if($forums_id)
{
$forums_id_ary = str_replace(" ", ",", $forums_id);
$forums_id_user = explode(",", $forums_id);
$event['sql_where'] = " t.forum_id IN (" . $forums_id_ary . ") ";
}
Not Working.3Di wrote: ↑Mon May 07, 2018 11:52 pm Try this:f.forum_id
instead oft.forum_id
Not tested.Code: Select all
$event['sql_where'] .= ' AND ' . $this->db->sql_in_set('f.forum_id', $forums_id_ary);
main_listener.php
$event['sql_where'] .= ' AND ' . $this->db->sql_in_set('t.forum_id', $forums_id_user);