ElggComment.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * \ElggComment
  4. *
  5. * @package Elgg.Core
  6. * @subpackage Comments
  7. * @since 1.9.0
  8. */
  9. class ElggComment extends \ElggObject {
  10. /**
  11. * Set subtype to comment
  12. *
  13. * @return void
  14. */
  15. protected function initializeAttributes() {
  16. parent::initializeAttributes();
  17. $this->attributes['subtype'] = "comment";
  18. }
  19. /**
  20. * Can a user comment on this object? Always returns false (threaded comments
  21. * not yet supported)
  22. *
  23. * @see \ElggEntity::canComment()
  24. *
  25. * @param int $user_guid User guid (default is logged in user)
  26. * @return bool False
  27. * @since 1.9.0
  28. */
  29. public function canComment($user_guid = 0) {
  30. return false;
  31. }
  32. /**
  33. * Update container entity last action on successful save.
  34. *
  35. * @param bool $update_last_action Update the container entity's last_action field
  36. * @return bool|int
  37. */
  38. public function save($update_last_action = true) {
  39. $result = parent::save();
  40. if ($result && $update_last_action) {
  41. update_entity_last_action($this->container_guid, $this->time_updated);
  42. }
  43. return $result;
  44. }
  45. }