function postContent() { $this->gatekeeper(); if ($url = $this->getInput('feed')) { if ($feed = \Idno\Core\Idno::site()->reader()->getFeedObject($url)) { $subscription = new Subscription(); $subscription->setOwner(\Idno\Core\Idno::site()->session()->currentUser()); $subscription->setFeedURL($feed->getFeedURL()); $subscription->setTitle(\Idno\Core\Idno::site()->session()->currentUser()->getHandle() . ' subscribed to ' . $feed->getTitle()); if ($subscription->save()) { \Idno\Core\Idno::site()->session()->addMessage("You're following " . $feed->getTitle() . '!'); $this->forward(\Idno\Core\Idno::site()->config()->getURL() . 'following/'); } } $this->forward(\Idno\Core\Idno::site()->config()->getURL() . 'following/confirm/?feed=' . urlencode($feed->url)); } }
/** * Retrieve a particular user's subscriptions * @param $user * @return array|bool */ function getUserSubscriptions($user) { if ($user instanceof User) { $user = $user->getUUID(); } if (empty($user)) { return false; } return Subscription::get(array('owner' => $user)); }
/** * Get a user's subscriptions * @param $user * @return array */ static function getByUser($user) { return Subscription::get(array('owner' => $user->getUUID())); }