public function _buildQuery() { $db =& JFactory::getDBO(); $actor = JRequest::getVar('actor', ''); $archived = JRequest::getInt('archived', 0); $app = JRequest::getVar('app', 'none'); $where = array(); CFactory::load('helpers', 'user'); $userId = cGetUserId($actor); if ($userId != 0) { $where[] = 'actor=' . $db->Quote($userId) . ' '; } if ($archived != 0) { $archived = $archived - 1; $where[] = 'archived=' . $db->Quote($archived) . ' '; } if ($app != 'none') { $where[] = 'app=' . $db->Quote($app); } $query = 'SELECT * FROM ' . $db->nameQuote('#__community_activities'); if (!empty($where)) { for ($i = 0; $i < count($where); $i++) { if ($i == 0) { $query .= ' WHERE '; } else { $query .= ' AND '; } $query .= $where[$i]; } } $query .= ' ORDER BY created DESC'; return $query; }
/** * This method should handle any login logic and report back to the subject * * @access public * @param array holds the user data * @param array extra options * @return boolean True on success * @since 1.5 */ function onLoginUser($user, $options) { CFactory::load('helpers', 'user'); $id = cGetUserId($user['username']); CFactory::setActiveProfile($id); return true; }