LPH
Well-known member
How do I get a listing of only forums from a select category? Is there something that can be added to the $node_qry to return a narrowed list?
This code will return a listing of all forums (limited to whatever is set) - and works well.
This code will return a listing of all forums (limited to whatever is set) - and works well.
PHP:
$number_of_forums = $instance['numberforums'];
/** Script to pull the forums from XenForo */
$node_qry = '
SELECT node_id, title, node_name, display_in_list FROM `xf_node`
WHERE display_in_list = 1 AND node_type_id = "Forum"
ORDER BY `node_id` DESC
LIMIT ' . $number_of_forums . '
';
$nodes = XenForo_Application::get( 'db' )->fetchAll( $node_qry );
$link = '';
foreach ( $nodes AS $node ) {
echo(
"<div class='entry-meta'><a href='"
. $XF->createLink( $link )
. XenForo_Link::buildPublicLink( 'forums', $node )
. "'>"
. XenForo_Helper_String::wholeWordTrim( $node['title'], 40 )
. "</a><br />"
);
}