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

core.posting_modify_template_vars pass some variables to listeners

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-b2
    • Fix Version/s: 3.1.0-b3
    • Component/s: Events
    • Labels:

      Description

      Originally posted here: https://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=45379

      In posting.php the event dispatcher is called directly triggering the core.posting_modify_template_vars event, but the event doesn't have any data, so it's impossible to modify the template array within the event listener.

      Instead the array should be assigned to a variable and then the event should be triggered with the variable.

      The flow has changed such that the template variables are assigned to an array first, which is then passed to the event listener, ofter that the template array is assigned to the template object.

      Around line 1477 in the beta:
      Replace:

      $template->assign_vars(array( ... ));
      $phpbb_dispatcher->dispatch('core.posting_modify_template_vars');
      

      With:

      $template_array = array(...);
      $vars = array('template_array');
      extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars)));
      $template->assign_vars(array( ... ));
      

      Not shown, but if possible please send the current forum and topic info to the event handler. Basically, I need to know what the current forum is, and whether or not the template is displaying a new post form, or edit the first post of a topic (not a reply).

        Attachments

          Activity

            People

            • Assignee:
              nickvergessen Joas Schilling
              Reporter:
              joelk2 joelk2
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: