[PHP] core.viewforum_get_topic_id_sql

Request hook events and what data needs to be sent for the new hook system.
Post Reply
Registered User
Posts: 7
Joined: Tue Mar 11, 2014 8:00 pm

[PHP] core.viewforum_get_topic_id_sql

Post by joelk »

Identifer: core.viewforum_get_topic_id_sql
Location: viewforum.php
Parameters: sql_array
Currently there is no way to restrict which topics get shows on a forums page. It is possible to join with another table to retrieve additional details, but restricting based on that join isn't possible.

Around line 510, it involves converting the sql from a string to an array like so:

Code: Select all

$sql_array = array(
    'SELECT'    => 't.topic_id',
	'FROM' => array(TOPICS_TABLE => 't'),
	'WHERE' => $sql_where
		. " AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
	'ORDER_BY' => "t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order);
Then triggering the event:

Code: Select all

$vars = array('sql_array');
extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_id_sql', compact($vars)));
$sql = $db->sql_build_query('SELECT', $sql_array);

User avatar
Registered User
Posts: 45
Joined: Wed Apr 16, 2014 2:28 pm

Re: [PHP] core.viewforum_get_topic_id_sql

Post by rfdy »

Will this event not be added?

Post Reply