[PHP] core.viewforum_get_topic_id_sql

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

[PHP] core.viewforum_get_topic_id_sql

Post by joelk » Tue Mar 25, 2014 7:34 pm

Identifer: core.viewforum_get_topic_id_sql
Location: viewforum.php
Parameters: sql_array
Explanation:
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 . ")
		$sql_approved
		$sql_limit_time",
	'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
rfdy
Registered User
Posts: 45
Joined: Wed Apr 16, 2014 2:28 pm

Re: [PHP] core.viewforum_get_topic_id_sql

Post by rfdy » Wed May 14, 2014 2:39 pm

Will this event not be added?


Post Reply