Merge branch 'MDL-34160-forum-subject' of https://github.com/brendanheywood/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 16 Feb 2016 11:04:41 +0000 (11:04 +0000)
committerDan Poltawski <dan@moodle.com>
Tue, 16 Feb 2016 11:04:41 +0000 (11:04 +0000)
1  2 
mod/forum/lib.php

diff --combined mod/forum/lib.php
@@@ -795,19 -795,22 +795,25 @@@ function forum_cron() 
                          $canreply
                      );
  
 +                $userfrom->customheaders[] = sprintf('List-Unsubscribe: <%s>',
 +                    $data->get_unsubscribediscussionlink());
 +
                  if (!isset($userto->viewfullnames[$forum->id])) {
                      $data->viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
                  } else {
                      $data->viewfullnames = $userto->viewfullnames[$forum->id];
                  }
  
+                 // Not all of these variables are used in the default language
+                 // string but are made available to support custom subjects.
                  $a = new stdClass();
-                 $a->courseshortname = $data->get_coursename();
-                 $a->forumname = $cleanforumname;
                  $a->subject = $data->get_subject();
+                 $a->forumname = $cleanforumname;
+                 $a->sitefullname = format_string($site->fullname);
+                 $a->siteshortname = format_string($site->shortname);
+                 $a->courseidnumber = $data->get_courseidnumber();
+                 $a->coursefullname = $data->get_coursefullname();
+                 $a->courseshortname = $data->get_coursename();
                  $postsubject = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
  
                  // Send the post now!
@@@ -3193,11 -3196,6 +3199,11 @@@ function forum_print_post($post, $discu
      // Prepare an array of commands
      $commands = array();
  
 +    // Add a permalink.
 +    $permalink = new moodle_url($discussionlink);
 +    $permalink->set_anchor('p' . $post->id);
 +    $commands[] = array('url' => $permalink, 'text' => get_string('permalink', 'forum'));
 +
      // SPECIAL CASE: The front page can display a news item post to non-logged in users.
      // Don't display the mark read / unread controls in this case.
      if ($istracked && $CFG->forum_usermarksread && isloggedin()) {