Ticket #353: friend-comm-messages.diff

File friend-comm-messages.diff, 5.8 kB (added by justinr, 4 months ago)
  • mod/friend/lib/friends_actions.php

    old new  
    2525                                $u = get_record('users','ident',$friend_id); 
    2626                            $message_body = sprintf(__gettext("%s has added you as a friend!\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),$_SESSION['name'], $CFG->wwwroot . user_info("username",$USER->ident) . "/", $CFG->wwwroot . user_info("username",$friend_id) . "/friends/",$CFG->sitename); 
    2727                            $title = sprintf(__gettext("New %s friend"), $CFG->sitename); 
    28                             notify_user($u,$title,$message_body); 
     28                            message_user($u,$USER->ident,$title,$message_body); 
    2929                            plugin_hook('friends','publish',$f); 
    3030                        } 
    3131                    } else { 
     
    4040                            $u = get_record('users','ident',$friend_id); 
    4141                            $message_body = sprintf(__gettext("%s has requested to add you as a friend!\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your friends requests and approve or deny this user, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),$_SESSION['name'], $CFG->wwwroot . user_info("username",$USER->ident) . "/", $CFG->wwwroot . user_info("username",$friend_id) . "/friends/requests",$CFG->sitename); 
    4242                            $title = sprintf(__gettext("New %s friend request"), $CFG->sitename); 
    43                             notify_user($u,$title,$message_body); 
     43                            message_user($u,$USER->ident,$title,$message_body); 
    4444                        } 
    4545                    } else { 
    4646                        if (user_info("user_type",$friend_id) == "person") { 
     
    8989                         $messages[] = sprintf(__gettext("You approved the friendship request. %s now lists you as a friend."),stripslashes($request->name)); 
    9090                         $message_body = sprintf(__gettext("%s has approved your friendship request!\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),user_name($request->friend), $CFG->wwwroot . user_info("username",$request->friend) . "/", $CFG->wwwroot . user_info("username",$request->owner) . "/friends/",$CFG->sitename); 
    9191                         $title = sprintf(__gettext("%s friend request approved!"), $CFG->sitename); 
    92                          notify_user($request->owner,$title,$message_body); 
     92                         message_user($request->owner,$request->friend,$title,$message_body); 
    9393                         plugin_hook('friends','publish',$f); 
    9494                     } else { 
    9595                         $messages[] = __gettext("An error occurred: couldn't add you as a friend"); 
     
    115115                     $messages[] = sprintf(__gettext("You declined the friendship request. %s does not list you as a friend."),stripslashes($request->name)); 
    116116                     $message_body = sprintf(__gettext("%s has denied your friendship request.\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your existing friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),user_name($request->friend), $CFG->wwwroot . user_info("username",$request->friend) . "/", $CFG->wwwroot . user_info("username",$request->owner) . "/friends/",$CFG->sitename); 
    117117                     $title = sprintf(__gettext("%s friend request denied"), $CFG->sitename); 
    118                      notify_user($request->owner,$title,$message_body); 
     118                     message_user($request->owner,$request->friend,$title,$message_body); 
    119119                 } else { 
    120120                     $messages[] = __gettext("Error: you do not have authority to modify this friendship request."); 
    121121                 } 
  • mod/community/lib/community_member_add.php

    old new  
    2929 
    3030                    $message_body= sprintf(__gettext("%s has joined %s!\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all community members, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."), $_SESSION['name'], $friend->name, $CFG->wwwroot . user_info("username", $USER->ident) . "/", $CFG->wwwroot . $friend->username . "/community/members", $CFG->sitename); 
    3131                    $title= sprintf(__gettext("New %s member"), $friend->name); 
    32                     notify_user($owner->ident, $title, $message_body); 
     32                    message_user($owner->ident, $friend_id, $title, $message_body); 
    3333                    plugin_hook("community:member","publish",$f); 
    3434 
    3535                } else 
     
    3939                            $message_body= sprintf(__gettext("%s has applied to join %s!\n\nTo visit this user's profile, click on the following link:\n\n\t" . 
    4040                                "%s\n\nTo view all membership requests and approve or deny this user, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."), $_SESSION['name'], $friend->name, $CFG->wwwroot . user_info("username", $USER->ident) . "/", $CFG->wwwroot . $friend->username . "/community/members", $CFG->sitename); 
    4141                            $title= sprintf(__gettext("New %s member request"), $friend->name); 
    42                             notify_user($owner->ident, $title, $message_body); 
     42                            message_user($owner->ident, $friend_id, $title, $message_body); 
    4343                        } 
    4444                    } else 
    4545                        if ($friend->moderation == "priv") {