/** * Provide a link to social profile. * * <code> * $keys = array( * 'user_id' => $userId * ); * * $profile = new Prism\Integration\Profile\Socialcommunity(\JFactory::getDbo()); * $profile->load($keys); * * $link = $profile->getLink(); * </code> * * @param bool $route Route or not the link. * * @return string */ public function getLink($route = true) { $link = ''; if ($this->slug !== '') { $link = \SocialcommunityHelperRoute::getProfileRoute($this->slug); if ($route) { $link = \JRoute::_($link); } } return $link; }
/** * Get a link to user profile. * * <code> * $ids = array(1, 2, 3, 4); * $userId = 1; * * $profiles = new Prism\Integration\Profiles\Socialcommunity(\JFactory::getDbo()); * $profiles->load($ids); * * $link = $profiles->getLink($userId); * </code> * * @param int $userId * @param bool $route Route or not the link. * * @return string */ public function getLink($userId, $route = true) { $link = ''; if (array_key_exists($userId, $this->profiles) and $this->profiles[$userId]->slug !== '') { $link = \SocialcommunityHelperRoute::getProfileRoute($this->profiles[$userId]->slug); if ($route) { $link = \JRoute::_($link); } } return $link; }