Stuart Wright
Well-known member
Hi folks,
I'm using the two page solution for Google CSE.
A query parameter, q, is passed to the results page.
I found a code snippet for a callback on a page which Jake posted for user id:
Obviously q is going to be a string, though.
I'm assuming I have to change XenForo_Input::UINT to a string.
and then just return $response->params['q'] = $q;
Which XF function is it I would have to use instead of
$q = $controller->getInput()->filterSingle('q', XenForo_Input::UINT);
?
Thanks
I'm using the two page solution for Google CSE.
A query parameter, q, is passed to the results page.
I found a code snippet for a callback on a page which Jake posted for user id:
PHP:
<?php
class Callback_PageNode
{
public static function getUser(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
{
$userId = $controller->getInput()->filterSingle('u', XenForo_Input::UINT);
$userModel = XenForo_Model::create('XenForo_Model_User');
$user = $userModel->getFullUserById($userId);
$user = $userModel->prepareUser($user);
$response->params['user'] = $user;
}
}
I'm assuming I have to change XenForo_Input::UINT to a string.
and then just return $response->params['q'] = $q;
Which XF function is it I would have to use instead of
$q = $controller->getInput()->filterSingle('q', XenForo_Input::UINT);
?
Thanks