Commit f310c84a authored by Richard Mansfield's avatar Richard Mansfield
Browse files
parents 27dee023 8dcf8e5e
...@@ -31,10 +31,10 @@ require(dirname(dirname(__FILE__)) . '/init.php'); ...@@ -31,10 +31,10 @@ require(dirname(dirname(__FILE__)) . '/init.php');
json_headers(); json_headers();
$pending = param_boolean('pending', false); $pending = param_boolean('pending');
$limit = param_integer('limit', 10); $limit = param_integer('limit', 10);
$offset = param_integer('offset', 0); $offset = param_integer('offset', 0);
$control = param_boolean('control', false); $control = param_boolean('control');
$prefix = get_config('dbprefix'); $prefix = get_config('dbprefix');
$userid = $USER->get('id'); $userid = $USER->get('id');
...@@ -53,7 +53,7 @@ if ($control) { ...@@ -53,7 +53,7 @@ if ($control) {
json_reply(true, $e->getMessage()); json_reply(true, $e->getMessage());
} }
$user = get_record('usr', 'id', $values['id']); $user = get_record('usr', 'id', $values['id']);
friend_submit($values); friend_submit(null, $values);
exit; exit;
} }
......
...@@ -481,7 +481,7 @@ function suspend_user($suspendeduserid, $reason, $suspendinguserid=null) { ...@@ -481,7 +481,7 @@ function suspend_user($suspendeduserid, $reason, $suspendinguserid=null) {
* handle the add/remove/approve/reject friend form * handle the add/remove/approve/reject friend form
* @param array $values from pieforms. * @param array $values from pieforms.
*/ */
function friend_submit(Pieform $form, $values) { function friend_submit($form, $values) {
global $user, $USER; global $user, $USER;
log_debug($values); log_debug($values);
...@@ -556,7 +556,13 @@ function friend_submit(Pieform $form, $values) { ...@@ -556,7 +556,13 @@ function friend_submit(Pieform $form, $values) {
break; break;
} }
activity_occurred('maharamessage', $n); activity_occurred('maharamessage', $n);
$form->json_reply(PIEFORM_OK, get_string('friendform' . $values['type'] . 'success', 'mahara', display_name($user)));
if ($form instanceof Pieform) {
$form->json_reply(PIEFORM_OK, get_string('friendform' . $values['type'] . 'success', 'mahara', display_name($user)));
}
else {
json_reply(false, get_string('friendform' . $values['type'] . 'success', 'mahara', display_name($user)));
}
} }
/** /**
......
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