Ticket #340: commentwall-msg-content.diff

File commentwall-msg-content.diff, 2.1 kB (added by justinr, 5 months ago)

include commentwall content in message

  • mod/commentwall/lib.php

    old new  
    9191         */ 
    9292        function commentwall_addcomment($wall_id, $poster_id, $text) 
    9393        { 
    94                global $CFG; 
    95                 
    96                $newcomment = new stdClass; 
    97                        $newcomment->wallowner = $wall_id; 
    98                        $newcomment->comment_owner = $poster_id; 
    99                        $newcomment->content = $text; 
    100                        $newcomment->posted = time(); 
    101                         
    102         if ($newcomment->ident = insert_record("commentwall", $newcomment)) { 
     94          global $CFG; 
     95           
     96          $newcomment = new stdClass; 
     97          $newcomment->wallowner = $wall_id; 
     98          $newcomment->comment_owner = $poster_id; 
     99          $newcomment->content = $text; 
     100          $newcomment->posted = time(); 
     101           
     102         if ($newcomment->ident = insert_record("commentwall", $newcomment)) { 
    103103            if ($newcomment->comment_owner != $newcomment->wallowner) { 
    104                         message_user($wall_id, $poster_id, __gettext("Someone has posted to your comment wall"), __gettext("Check it out") . ": " . $CFG->wwwroot . user_info("username", $wall_id) . "/profile/"); 
     104               
     105              $message = __gettext(sprintf("You have received a comment from %s on your comment wall:", user_name($newcomment->comment_owner), stripslashes($object_title))); 
     106              $message .= "\n\n" . stripslashes($newcomment->content) . "\n\n"; 
     107              $message .= __gettext(sprintf("To reply on %s's comment wall, click here: %s", user_name($newcomment->comment_owner), $CFG->wwwroot . user_info("username", $newcomment->comment_owner) . "/profile/")) . "\n"; 
     108              $message .= __gettext(sprintf("To see other comments on your wall, click here: %s", $CFG->wwwroot . user_info("username", $newcomment->wallowner) . "/profile/")); 
     109              $message = wordwrap($message); 
     110               
     111 
     112              message_user($wall_id, $newcomment->comment_owner,  __gettext(sprintf("%s has posted to your comment wall", user_name($newcomment->comment_owner))), $message); 
    105113            } 
    106114                        $newcomment = plugin_hook("commentwall","publish",$newcomment);  
    107115            return $newcomment->ident;