X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile.php;h=f41acad4c89aa1d563cf2603f7cf75a791a15788;hb=14fa99eab5750b7d5b2598060b118c8f82deb01a;hp=000590a98fa34380a92a9934fa1669e85718a52e;hpb=c02a01914ab67c2bc25850034a75ee1046fd6870;p=quix0rs-gnu-social.git diff --git a/classes/Profile.php b/classes/Profile.php index 000590a98f..f41acad4c8 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -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; + } }