]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Rewriting time_created and time_updated instead of trying to be tricky with metadata.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 21 Apr 2010 19:09:31 +0000 (19:09 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 21 Apr 2010 19:09:31 +0000 (19:09 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5837 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/blog/blog_lib.php

index de7cc1b96149f577ec9988e952797737a7410582..4d330c29574270a4eea71088222a6dde8de764b3 100644 (file)
@@ -307,13 +307,17 @@ class ElggBlog extends ElggObject {
        }
 
        /**
-        * Override the value returned for time_created
+        * Rewrite the time created to be publish time.
+        * This is a bit dirty, but required for proper sorting.
         */
-       public function __get($name) {
-               if ($name == 'time_created') {
-                       $name = 'time_created';
+       public function save() {
+               if (parent::save()) {
+                       global $CONFIG;
+                       $published = $this->publish_date;
+                       $sql = "UPDATE {$CONFIG->dbprefix}entities SET time_created = '$published', time_updated = '$published'";
+                       return update_data($sql);
                }
 
-               return $this->get($name);
+               return FALSE;
        }
 }
\ No newline at end of file