]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
UNDO: use DB_DataObject join
[quix0rs-gnu-social.git] / classes / Profile.php
index 000590a98fa34380a92a9934fa1669e85718a52e..f41acad4c89aa1d563cf2603f7cf75a791a15788 100644 (file)
@@ -137,4 +137,19 @@ class Profile extends DB_DataObject
        function getBestName() {
                return ($this->fullname) ? $this->fullname : $this->nickname;
        }
+
+    # Get latest notice on or before date; default now
+       function getCurrentNotice($dt=NULL) {
+               $notice = new Notice();
+               $notice->profile_id = $this->id;
+               if ($dt) {
+                       $notice->whereAdd('created < "' . $dt . '"');
+               }
+               $notice->orderBy('created DESC');
+               $notice->limit(1);
+               if ($notice->find(true)) {
+                       return $notice;
+               }
+               return NULL;
+       }
 }