public function getProfileURL($user, $task = '', $xhtml = true) { if ($user == 0) return false; $user = KunenaFactory::getUser ( $user ); $my = JFactory::getUser (); if ($user === false) return false; $userid = $my->id != $user->userid ? '&userid=' . AlphaUserPointsHelper::getAnyUserReferreID ( $user->userid ) : ''; $AUP_itemid = AlphaUserPointsHelper::getItemidAupProfil (); return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=account' . $userid . '&Itemid=' . $AUP_itemid, $xhtml ); }
public function getProfileURL($user, $task = '', $xhtml = true) { if ($user == 0) return false; $user = KunenaFactory::getUser ( $user ); $my = JFactory::getUser (); if ($user === false) return false; $userid = $my->id != $user->userid ? '&userid=' . AlphaUserPointsHelper::getAnyUserReferreID ( $user->userid ) : ''; if (method_exists ( 'AlphaUserPointsHelper', 'getItemidAupProfil' )) { $AUP_itemid = AlphaUserPointsHelper::getItemidAupProfil (); } else { $db = JFactory::getDBO (); $query = "SELECT id FROM #__menu WHERE link='index.php?option=com_alphauserpoints&view=account' AND type='component' AND published='1'"; $db->setQuery ( $query ); $AUP_itemid = intval ( $db->loadResult () ); } return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=account' . $userid . '&Itemid=' . $AUP_itemid, $xhtml ); }
public static function getAupAvatar($userid, $linktoprofil = 0, $width = '', $height = '', $class = '', $otherprofileurl = '') { if (!$userid) { return; } if (!defined("_AUP_AVATAR_PATH")) { // prevent call in administrator backend $juriroot = str_replace(DS . 'administrator', '', JURI::root()); define('_AUP_AVATAR_PATH', JURI::root() . 'components/com_alphauserpoints/assets/images/avatars/'); } else { $juriroot = $juriroot = str_replace(DS . 'administrator', '', JURI::root()); } if (!defined("_AUP_AVATAR_LIVE_PATH")) { // prevent call in administrator backend $juribase = str_replace('/administrator', '', JURI::base()); define('_AUP_AVATAR_LIVE_PATH', $juribase . 'components/com_alphauserpoints/assets/images/avatars/'); } else { $juribase = str_replace('/administrator', '', JURI::base()); } $startprofil = ""; $endprofil = ""; $setwidth = $width != '' ? ' width="' . $width . '"' : ''; $setheight = $height != '' ? ' height="' . $height . '"' : ''; $setclass = $class != '' ? ' class="' . $class . '"' : ''; $profile = AlphaUserPointsHelper::getUserInfo('', $userid); $avatar = $profile->avatar != '' ? _AUP_AVATAR_LIVE_PATH . $profile->avatar : _AUP_AVATAR_PATH . 'generic_gravatar_grey.png'; //$avatar = JURI::root() . "components/com_alphauserpoints/assets/phpThumb/phpThumb.php?src=".$avatar."&w=" . $width ."&h=" . $height; $avatar = '<img src="' . $avatar . '" border="0" alt=""' . $setwidth . $setheight . $setclass . ' />'; $profileitemid = ''; if ($linktoprofil) { $profileitemid = '&Itemid=' . AlphaUserPointsHelper::getItemidAupProfil(); $profil = $otherprofileurl ? $otherprofileurl : "index.php?option=com_alphauserpoints&view=account&userid=" . $profile->referreid . $profileitemid; $startprofil = "<a href=\"" . JRoute::_($profil) . "\">"; $endprofil = "</a>"; $avatar = $startprofil . $avatar . $endprofil; } return $avatar; // USAGE // $avatar = AlphaUserPointsHelper::getAupAvatar($userid, [int $linktoprofil], [int $width], [int $height], [string $class], [string $otherprofileurl]); // if $linktoprofil set to 1, display avatar with the link to the AUP profil of this user // Think to call and include this API helper.php in your script }