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

Add core event on viewtopic post_list query for query modification

    XMLWordPrintable

Details

    • Improvement
    • Status: Unverified Fix (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.2.2
    • 3.2.4-RC1
    • Events
    • PHP 7.1.7, MySQL 5.6.34, Firefox 61.0

    Description

      When the posts in a topic are fetched and ordered, it is stored in post_list.  Changing the order of post_list can be done in the viewtopic_get_post_data event, but unfortunately there is no control over the initial sql in which these are fetched.  If I wanted to control the posts that were initially selected with a custom parameter, this couldn't be done.  If I wanted to still show soft deleted posts to members and guests, this couldn't be done either.

      I'm writing an extension that allows you to comment on posts. I need to select the posts that are only posting to the topic, as I want the topic to only count parent posts for the page total and pagination.  Without it pages with comments, as well as any url with &p=post_id in it wont function properly.  I've been able to solve my issue by adding a condition to the where clause in the sql query on lines 1144 - 1151, having the initial post_list query only select parent posts of depth 0 (not commenting on anybody).  This has solved all of my issues with only a couple of words added to the query, as it doesn't select comments in that query, allowing it to behave normally everywhere else as intended.

       

      I just made a pull request.

      Is this the correct version to affect, or should i have selected 3.2.3-RC1/RC2?

      Attachments

        Activity

          People

            Marc Marc
            Toxyy Toxyy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: