Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12305

Add new event core.viewforum_get_topic_id_sql to control forum topic listing

    XMLWordPrintable

Details

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

    Description

      As per https://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=45383

      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:

      $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:

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            joelk2 joelk2 [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: