function getViewProfile() { $app = JFactory::getApplication(); $db = JFactory::getDbo(); $user = JFactory::getUser(); $userid = $app->input->get('id', $user->id, 'int'); //get the user id from 'get' variable; else default is current user id $isUserBlocked = JFactory::getUser($userid)->block; //redirect the user to dashboard if the user is blocked. if ($isUserBlocked == 1) { $msg = JText::_('COM_JBLANCE_USER_ACCOUNT_BANNED_VIEWING_PROFILE_NOT_POSSIBLE'); $link_dash = JRoute::_('index.php?option=com_jblance&view=user&layout=dashboard', false); $app->enqueueMessage($msg, 'error'); $app->redirect($link_dash); } //redirect to the appropriate extension based on integration $profileInteg = JblanceHelper::getProfile(); if (!$profileInteg instanceof JoombriProfileJoombri) { $url = LinkHelper::GetProfileURL($userid, false); if ($url) { $app->redirect($url); } } $jbuser = JblanceHelper::get('helper.user'); // create an instance of the class UserHelper $userInfo = $jbuser->getUser($userid); $jbfields = JblanceHelper::get('helper.fields'); // create an instance of the class FieldsHelper $fields = $jbfields->getUserGroupTypeFields($userInfo->ug_id); //freelancer projects $query = "SELECT p.*,r.comments FROM #__jblance_project p " . "LEFT JOIN #__jblance_rating r ON r.project_id=p.id " . "WHERE p.assigned_userid =" . $db->quote($userid) . " AND p.status='COM_JBLANCE_CLOSED' AND r.target=" . $db->quote($userid) . " " . "ORDER BY p.id DESC LIMIT 10"; $db->setQuery($query); $fprojects = $db->loadObjectList(); //freelancer rating $query = "SELECT AVG(quality_clarity) quality_clarity,AVG(communicate) communicate,AVG(expertise_payment) expertise_payment, " . "AVG(professional) professional,AVG(hire_work_again) hire_work_again FROM #__jblance_rating " . "WHERE target=" . $db->quote($userid) . " AND quality_clarity<>0 AND rate_type='COM_JBLANCE_FREELANCER'"; $db->setQuery($query); $frating = $db->loadObject(); //buyer projects $query = "SELECT p.*,r.comments FROM #__jblance_project p " . "LEFT JOIN #__jblance_rating r ON r.project_id=p.id " . "WHERE p.publisher_userid =" . $db->quote($userid) . " AND r.target=" . $db->quote($userid) . " " . "ORDER BY p.id DESC LIMIT 10"; $db->setQuery($query); $bprojects = $db->loadObjectList(); //buyer rating $query = "SELECT AVG(quality_clarity) quality_clarity,AVG(communicate) communicate,AVG(expertise_payment) expertise_payment, " . "AVG(professional) professional,AVG(hire_work_again) hire_work_again FROM #__jblance_rating " . "WHERE target=" . $db->quote($userid) . " AND quality_clarity <> 0 AND rate_type='COM_JBLANCE_BUYER'"; $db->setQuery($query); $brating = $db->loadObject(); $query = "SELECT * FROM #__jblance_portfolio WHERE user_id =" . $db->quote($userid) . " AND published=1"; $db->setQuery($query); $portfolios = $db->loadObjectList(); $return[0] = $userInfo; $return[1] = $fields; $return[2] = $fprojects; $return[3] = $frating; $return[4] = $bprojects; $return[5] = $brating; $return[6] = $portfolios; return $return; }