diff options
Diffstat (limited to 'classes/Profile.php')
-rw-r--r-- | classes/Profile.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index 000590a98..f41acad4c 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; + } } |