Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-14051

[PHP] core.viewforum_modify_sort_data_sql

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.9-RC1
    • None
    • Events
    • None

      Identifer: core.viewforum_modify_sort_data_sql
      Location: viewforum.php
      Parameters: sql_ary
      Explanation: Replaces the SQL query and adds a SQL modifier event to the Viewforum topics sort function.

      Origin:

      	$sql = 'SELECT COUNT(topic_id) AS num_topics
      		FROM ' . TOPICS_TABLE . "
      		WHERE forum_id = $forum_id
      			AND (topic_last_post_time >= $min_post_time
      				OR topic_type = " . POST_ANNOUNCE . '
      				OR topic_type = ' . POST_GLOBAL . ')
      			AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id);
      	$result = $db->sql_query($sql);
      

      Now:

      	$sql_ary = array(
      		'SELECT'	=> 'COUNT(t.topic_id) AS num_topics',
      		'FROM'		=> array(
      			TOPICS_TABLE	=> 't',
      		),
      		'WHERE'		=> 't.forum_id = ' . $forum_id . '
      			AND (t.topic_last_post_time >= ' . $min_post_time . '
      				OR t.topic_type = ' . POST_ANNOUNCE . '
      				OR t.topic_type = ' . POST_GLOBAL . ')
      			AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id),
      	);
       
      	/**
      	* Modify the sort data SQL query for getting additional fields if needed
      	*
      	* @event core.viewforum_modify_sort_data_sql
      	* @var	array	sql_ary			The SQL array
      	* @since 3.1.6-RC1
      	*/
      	$vars = array('sql_ary');
      	extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_data_sql', compact($vars)));
       
      	$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
      

            Marc Marc
            ABDev Adrien Bonnel
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: