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

Add php event for modifying the data when composing a PM

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.4-RC1
    • 3.1.3
    • Events
    • None

      Identifer: core.ucp_pm_compose_alter_vars
      Location: /includes/ucp/ucp_pm_compose.php (after [c]$user->add_lang('viewtopic');[/c])
      Parameters: 'msg_id', 'to_user_id', 'to_group_id', 'submit', 'preview', 'action', 'delete', 'reply_to_all'
      Explanation: Allow Extensions to modify the default vars before composing a PM. The current events are only called if $sql != '' (which would be false in the case of posting a new PM). Example code:

      // A new permission that allows users to reply to PMs, but not compose new ones
      public function ucp_pm_compose_alter_vars($event)
      {
          $action = $event['action'];
       
          if ($action == 'post' && !$this->auth->acl_get('u_post_pm'))
          {
              throw new \phpbb\exception\http_exception(403, 'NOT_AUTHORISED');
          }
      }

      I can start on a pull request shortly if there are no objections or issues with the proposed event.

      Area51 topic: http://area51.phpbb.com/phpBB/viewtopic.php?f=111&t=47256

            Marc Marc
            kinerity Kailey Truscott [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: