summaryrefslogtreecommitdiff
path: root/classes/User.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-22 12:02:13 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-22 12:02:13 -0400
commit64ed01f0aff569da2fd4ed589df9ed4ee9852cb7 (patch)
treed385c10c3aef1408bf62fc9003bb2d697536e299 /classes/User.php
parentab1f2ff9d07088c7a3607ee6d05b1042d735960d (diff)
centralize and optimize with-friends query
darcs-hash:20080722160213-84dde-2e466b9cc4601a8cb7237770a7df17a2f9dcadb9.gz
Diffstat (limited to 'classes/User.php')
-rw-r--r--classes/User.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php
index e4928eb34..1772b82e0 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -128,4 +128,23 @@ class User extends DB_DataObject
return true;
}
+
+ function noticesWithFriends() {
+
+ $notice = new Notice();
+
+ $notice->selectAs();
+
+ $subscription = new Subscription();
+
+ $subscription->subscriber = $this->id;
+
+ $notice->joinAdd($subscription);
+ $notice->whereAdd('notice.profile_id = subscription.subscribed');
+ $notice->selectAs($subscription, 'sub_%');
+
+ $notice->orderBy('created DESC, notice.id DESC');
+
+ return $notice;
+ }
}