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

[PHP] core.viewforum_modify_sort_data_sql

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • 3.1.9-RC1
    • Events
    • None

    Description

      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));
      

      Attachments

        Activity

          People

            Marc Marc
            ABDev Adrien Bonnel [X] (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: