diff options
Diffstat (limited to 'mod/blog/classes')
| -rw-r--r-- | mod/blog/classes/ElggBlog.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/mod/blog/classes/ElggBlog.php b/mod/blog/classes/ElggBlog.php index 7a64a1777..8d4401c57 100644 --- a/mod/blog/classes/ElggBlog.php +++ b/mod/blog/classes/ElggBlog.php @@ -1,6 +1,10 @@ <?php /** * Extended class to override the time_created + * + * @property string $status The published status of the blog post (published, draft) + * @property string $comments_on Whether commenting is allowed (Off, On) + * @property string $excerpt An excerpt of the blog post used when displaying the post */ class ElggBlog extends ElggObject { @@ -14,29 +18,25 @@ class ElggBlog extends ElggObject { } /** - * @todo this won't work until we have date l10n working. - * Rewrite the time created to be publish time. - * This is a bit dirty, but required for proper sorting. + * Can a user comment on this blog? + * + * @see ElggObject::canComment() + * + * @param int $user_guid User guid (default is logged in user) + * @return bool + * @since 1.8.0 */ -// public function save() { -// if (parent::save()) { -// global $CONFIG; -// -// // try to grab the publish date, but default to now. -// foreach (array('publish_date', 'time_created') as $field) { -// if (isset($this->$field) && $this->field) { -// $published = $this->field; -// break; -// } -// } -// if (!$published) { -// $published = time(); -// } -// -// $sql = "UPDATE {$CONFIG->dbprefix}entities SET time_created = '$published', time_updated = '$published' WHERE guid = '{$this->getGUID()}'"; -// return update_data($sql); -// } -// -// return FALSE; -// } + public function canComment($user_guid = 0) { + $result = parent::canComment($user_guid); + if ($result == false) { + return $result; + } + + if ($this->comments_on == 'Off') { + return false; + } + + return true; + } + }
\ No newline at end of file |
