diff options
-rw-r--r-- | mod/blog/actions/blog/save.php | 17 | ||||
-rw-r--r-- | mod/blog/blog_lib.php | 14 | ||||
-rw-r--r-- | mod/blog/views/default/blog/forms/edit.php | 6 |
3 files changed, 22 insertions, 15 deletions
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 46af1bafb..0e8a696b9 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -110,13 +110,16 @@ foreach ($values as $name => $default) { } // build publish_date -$publish_month = get_input('publish_month'); -$publish_day = get_input('publish_day'); -$publish_year = get_input('publish_year'); -$publish_hour = get_input('publish_hour'); -$publish_minute = get_input('publish_minute'); -$datetime = "$publish_year-$publish_month-$publish_day $publish_hour:$publish_minute:00"; -$values['publish_date'] = date('U', strtotime($datetime)); +//$publish_month = get_input('publish_month'); +//$publish_day = get_input('publish_day'); +//$publish_year = get_input('publish_year'); +//$publish_hour = get_input('publish_hour'); +//$publish_minute = get_input('publish_minute'); +//$datetime = "$publish_year-$publish_month-$publish_day $publish_hour:$publish_minute:00"; +//$values['publish_date'] = date('U', strtotime($datetime)); + +// setting publish_date to now until the problems with locale dates can be resolved. +$values['publish_date'] = time(); // assign values to the entity, stopping on error. if (!$error) { 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); } diff --git a/mod/blog/views/default/blog/forms/edit.php b/mod/blog/views/default/blog/forms/edit.php index 81e4dae44..f8b39d964 100644 --- a/mod/blog/views/default/blog/forms/edit.php +++ b/mod/blog/views/default/blog/forms/edit.php @@ -190,12 +190,6 @@ $body_input </p> <p> - <label for="blog_publish_date">$publish_date_label</label> - $publish_date_input -</p> - - -<p> <label for="blog_tags">$tags_label</label> $tags_input </p> |