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

include poster's username in email notifications of posts that get approved by moderators

XMLWordPrintable

      Phpbb 3.0.x now includes the poster's username in the email notifications it sends out for posts that do not require moderator approval but omits that username in email notifications it sends out for posts that require moderator approval. This happens because the two calls of user_notification() in includes/mcp/mcp_queue.php leave out the last parameter of function user_notification (which is the username of the author of the post).

      mcp_queue.php already has the poster's username as a variable at the time it calls user_notification() so I don't know why this choice was made. The fix is as follows:

      OPEN
      includes/mcp/mcp_queue.php
       
      FIND
      				user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
       
      REPLACE WITH
      				user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id, $post_data['username']);
       
      FIND
      				user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
       
      REPLACE WITH
      				user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id, $post_data['username']);
      

      If you make that change, then:

      • there's no longer a reason for the function user_notification in includes/functions_posting.php to have a default for its last parameter since that function is only called three times in phpbb3 and after this change all three times will supply that last parameter and
      • there's no longer a reason to include an if clause in the email notification templates testing whether the username has been provided.

      Given that, you would also be able to make the following additional changes:

      OPEN
      includes/functions_posting.php
       
      FIND
      function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id, $author_name = '')
       
      REPLACE WITH
      function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id, $author_name)
       
      OPEN
      language/en/email/forum_notify.txt
       
      FIND
      <!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF -->
       
      REPLACE WITH
       by {AUTHOR_NAME}
       
      OPEN
      language/en/email/newtopic_notify.txt
       
      FIND
      <!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF -->
       
      REPLACE WITH
       by {AUTHOR_NAME}
       
      OPEN
      language/en/email/topic_notify.txt
       
      FIND
      <!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF -->
       
      REPLACE WITH
       by {AUTHOR_NAME}
      

            nickvergessen Joas Schilling
            asinshesq asinshesq [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: