blob: 9d9f6c8b78157369f54b2a400233dcfaa03a88d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
/**
* Ssend a message action
*
* @package ElggMessages
*/
$subject = strip_tags(get_input('subject'));
$body = get_input('body');
$recipient_guid = get_input('recipient_guid');
elgg_make_sticky_form('messages');
//$reply = get_input('reply',0); // this is the guid of the message replying to
if (!$recipient_guid) {
register_error(elgg_echo("messages:user:blank"));
forward("messages/compose");
}
$user = get_user($recipient_guid);
if (!$user) {
register_error(elgg_echo("messages:user:nonexist"));
forward("messages/compose");
}
// Make sure the message field, send to field and title are not blank
if (!$body || !$subject) {
register_error(elgg_echo("messages:blank"));
forward("messages/compose");
}
// Otherwise, 'send' the message
$result = messages_send($subject, $body, $recipient_guid, 0, $reply);
// Save 'send' the message
if (!$result) {
register_error(elgg_echo("messages:error"));
forward("messages/compose");
}
elgg_clear_sticky_form('messages');
system_message(elgg_echo("messages:posted"));
forward('messages/inbox/' . elgg_get_logged_in_user_entity()->username);
|