add.php 841 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Elgg Message board: add message action
  4. *
  5. * @package ElggMessageBoard
  6. */
  7. $message_content = get_input('message_content');
  8. $owner_guid = get_input("owner_guid");
  9. $owner = get_entity($owner_guid);
  10. if ($owner && !empty($message_content)) {
  11. $result = messageboard_add(elgg_get_logged_in_user_entity(), $owner, $message_content, $owner->access_id);
  12. if ($result) {
  13. system_message(elgg_echo("messageboard:posted"));
  14. $options = array(
  15. 'annotations_name' => 'messageboard',
  16. 'guid' => $owner->getGUID(),
  17. 'limit' => $num_display,
  18. 'pagination' => false,
  19. 'reverse_order_by' => true,
  20. 'limit' => 1
  21. );
  22. $output = elgg_list_annotations($options);
  23. echo $output;
  24. } else {
  25. register_error(elgg_echo("messageboard:failure"));
  26. }
  27. } else {
  28. register_error(elgg_echo("messageboard:blank"));
  29. }
  30. forward(REFERER);