Commit 3a2b2f89 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Make group membership request notifications in group owner's language

parent efd2f503
......@@ -82,16 +82,17 @@ function requestjoingroup_submit(Pieform $form, $values) {
'reason' => isset($values['reason']) ? $values['reason'] : null
)
);
$ownerlang = get_user_language($group->owner);
if (isset($values['reason']) && $values['reason'] != '') {
$message = get_string('grouprequestmessagereason', 'group', display_name($USER, get_record('usr', 'id', $group->owner)), $group->name, $values['reason']);
$message = get_string_from_language($ownerlang, 'grouprequestmessagereason', 'group', display_name($USER, get_record('usr', 'id', $group->owner)), $group->name, $values['reason']);
}
else {
$message = get_string('grouprequestmessage', 'group', display_name($USER, get_record('usr', 'id', $group->owner)), $group->name);
$message = get_string_from_language($ownerlang, 'grouprequestmessage', 'group', display_name($USER, get_record('usr', 'id', $group->owner)), $group->name);
}
require_once('activity.php');
activity_occurred('maharamessage',
array('users' => array($group->owner),
'subject' => get_string('grouprequestsubject', 'group'),
'subject' => get_string_from_language($ownerlang, 'grouprequestsubject', 'group'),
'message' => $message,
'url' => get_config('wwwroot') . 'group/view.php?id=' . $group->id));
$SESSION->add_ok_msg(get_string('grouprequestsent', 'group'));
......
......@@ -91,19 +91,20 @@ if (!empty($joincontrol)) {
$gmr->member = $USER->get('id');
$gmr->ctime = db_format_timestamp(time());
$owner = get_record('usr', 'id', $group->owner);
$lang = get_user_language($owner->id);
insert_record('group_member_request', $gmr);
if (empty($gmr->reason)) {
$message = get_string('grouprequestmessage', 'group',
$message = get_string_from_language($lang, 'grouprequestmessage', 'group',
display_name($USER, $owner), $group->name);
}
else {
$message = get_string('grouprequestmessagereason', 'group',
$message = get_string_from_language($lang, 'grouprequestmessagereason', 'group',
display_name($USER, $owner), $group->name, $gmr->reason);
}
require_once('activity.php');
activity_occurred('maharamessage',
array('users' => array($group->owner),
'subject' => get_string('grouprequestsubject', 'group'),
'subject' => get_string_from_language($lang, 'grouprequestsubject', 'group'),
'message' => $message,
'url' => get_config('wwwroot') . 'group/view.php?id=' . $id));
$SESSION->add_ok_msg(get_string('grouprequestsent', 'group'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment