• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Missing Argument

Gossamer

Active member
#1
I've put together a simple form to pull up a user. However, I'm getting this error now when attempting to pull up that user:
Missing argument 1 for Goss_MemberAwards_ControllerAdmin_MemberAwards::actionUser(), called in C:\xampp\htdocs\xenforo_DEV\library\XenForo\FrontController.php on line 351 and defined

  1. XenForo_Application::handlePhpError() in C:\xampp\htdocs\xenforo_DEV\library\Goss\MemberAwards\ControllerAdmin\MemberAwards.php at line 34
  2. Goss_MemberAwards_ControllerAdmin_MemberAwards->actionUser() in C:\xampp\htdocs\xenforo_DEV\library\XenForo\FrontController.php at line 351
  3. XenForo_FrontController->dispatch() in C:\xampp\htdocs\xenforo_DEV\library\XenForo\FrontController.php at line 134
  4. XenForo_FrontController->run() in C:\xampp\htdocs\xenforo_DEV\admin.php at line 13
This is my ControllerAdmin code:
PHP:
    public function actionSearch()
    {
        $username = $this->_input->filterSingle('username', XenForo_Input::STRING);
       
        $userModel = $this->_getUserModel();
       
        $user = $userModel->getUserByName($username);
       
        if(!$user)
        {
            return $this->responseError(new XenForo_Phrase('no_users_matched_specified_criteria'));
        }
       
        return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('member-awards/user', $user));
      
    }

    public function actionUser($user)
    {
       
        $viewParams = array();
       
        return $this->responseView(null, 'goss_memberawards_user', $viewParams);
    }
And this is what's in my template:
Code:
<xen:title>{xen:phrase goss_member_awards}</xen:title>

<xen:form action="{xen:adminlink member-awards/search}">
    <fieldset>
    <xen:textboxunit label="{xen:phrase user_name}:" name="username" value="{$criteria.username}" type="search" />
    </fieldset>
           
    <xen:submitunit save="{xen:phrase search}" />
</xen:form>
Any ideas on what I'm missing?
 

Thomas.B

Well-known member
#2
The HTTP query parameters are not passed directly to an action method. So in actionUser() you'd need to get them from the $this->_input object such as you get the username parameter in the first method.
 

Gossamer

Active member
#3
Thanks, that fixed it!

For anybody curious, this is my new actionUser function:
PHP:
public function actionUser()
    {
        $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
       
        $userModel = $this->_getUserModel();
        $user = $userModel->getUserById($userId);
       
        $viewParams = array(
            'user' => $user
        );
       
        return $this->responseView(null, 'goss_memberawards_user', $viewParams);
    }