aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/blog_lib.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog/blog_lib.php')
-rw-r--r--mod/blog/blog_lib.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/mod/blog/blog_lib.php b/mod/blog/blog_lib.php
index 50ba5e92d..9876b0a34 100644
--- a/mod/blog/blog_lib.php
+++ b/mod/blog/blog_lib.php
@@ -58,7 +58,7 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) {
if (!(isadminloggedin() || (isloggedin() && $owner_guid == $loggedin_userid))) {
$options['metadata_name_value_pairs'] = array(
array('name' => 'status', 'value' => 'published'),
- array('name' => 'publish_date', 'operand' => '<', 'value' => time())
+ //array('name' => 'publish_date', 'operand' => '<', 'value' => time())
);
}
@@ -320,7 +320,17 @@ class ElggBlog extends ElggObject {
public function save() {
if (parent::save()) {
global $CONFIG;
- $published = $this->publish_date;
+
+ // 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);
}