+ function getTaggedSubscribers($tag)
+ {
+ $qry =
+ 'SELECT profile.* ' .
+ 'FROM profile JOIN (subscription, profile_tag, profile_list) ' .
+ 'ON profile.id = subscription.subscriber ' .
+ 'AND profile.id = profile_tag.tagged ' .
+ 'AND profile_tag.tagger = profile_list.tagger AND profile_tag.tag = profile_list.tag ' .
+ 'WHERE subscription.subscribed = %d ' .
+ 'AND subscription.subscribed != subscription.subscriber ' .
+ 'AND profile_tag.tagger = %d AND profile_tag.tag = "%s" ' .
+ 'AND profile_list.private = false ' .
+ 'ORDER BY subscription.created DESC';
+
+ $profile = new Profile();
+ $tagged = array();
+
+ $cnt = $profile->query(sprintf($qry, $this->id, $this->id, $tag));
+
+ while ($profile->fetch()) {
+ $tagged[] = clone($profile);
+ }
+ return $tagged;
+ }
+
+ /**
+ * Get pending subscribers, who have not yet been approved.
+ *
+ * @param int $offset
+ * @param int $limit
+ * @return Profile
+ */
+ function getRequests($offset=0, $limit=null)
+ {
+ $qry =
+ 'SELECT profile.* ' .
+ 'FROM profile JOIN subscription_queue '.
+ 'ON profile.id = subscription_queue.subscriber ' .
+ 'WHERE subscription_queue.subscribed = %d ' .
+ 'ORDER BY subscription_queue.created DESC ';
+
+ if ($limit != null) {
+ if (common_config('db','type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
+ }
+
+ $members = new Profile();
+
+ $members->query(sprintf($qry, $this->id));
+ return $members;
+ }
+