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

Profile Tab Routing

Discussion in 'XenForo Development Discussions' started by silence, Sep 7, 2013.

  1. silence

    silence Well-Known Member

    So I'm making a profile-tab, and everything works so far, but there is one issue: How would I make it so the profile tab loads the content for the profile it's triggered on?

    I'm doing this but to no avail:
    ControllerPublic:
    PHP:
        public function actionTeamspeakUserStatisticsTab()
        {
            
    $input $this->getInput();
            
    $user_id $input->filterSingle('user_id'XenForo_Input::UINT);

            
    $statistics $this->_getUserStatisticsModel()->getUserStatistics($user_id);

            return 
    $this->responseView('XenForo_ViewPublic_Base''account_teamspeak_userstatistics', array(
                
    'simple' => true,
                
    'statistics' => $statistics
            
    ));
        }
    Route:
    PHP:
    <?php

    class Teamspeak_Route_Prefix_Account implements XenForo_Route_Interface
    {
        protected 
    $_subComponents = array(
            
    'identities' => array(
                
    'controller' => 'Teamspeak_ControllerPublic_Account_Identities'
            
    ),
            
    'viewer' => array(
                
    'controller' => 'Teamspeak_ControllerPublic_Account_Viewer'
            
    ),
            
    'userstatistics' => array(
                
    'controller' => 'Teamspeak_ControllerPublic_Account_UserStatistics',
                
    'intId' => 'user_id',
            )
            
    'settings' => array(
                
    'controller' => 'Teamspeak_ControllerPublic_Account_Settings'
            
    )
        );

        public function 
    match($routePathZend_Controller_Request_Http $requestXenForo_Router $router)
        {
            
    $controller 'Teamspeak_ControllerPublic_Account_Index';
            
    $action $router->getSubComponentAction($this->_subComponents$routePath$request$controller);

            return 
    $router->getRouteMatch($controller$action'account/teamspeak');
        }

        public function 
    buildLink($originalPrefix$outputPrefix$action$extension$data, array &$extraParams)
        {
            if (
    $action == "TeamspeakUserStatisticsTab")
            {
                return 
    XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix$action$extension$data'user_id'$strParams);
            }

            return 
    XenForo_Link::buildSubComponentLink($this->_subComponents$outputPrefix$action$extension$data);
        }
    }
    What exactly is the issue? It simply won't pass in the user_id of the person's profile!
     
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    silence likes this.
  3. silence

    silence Well-Known Member

  4. silence

    silence Well-Known Member

    Is there an addon that uses Profile Tabs so I can see what they did? I can't find one D:
    EDIT:
    Sorry I didn't listen @Nobita.Kun you were absolutely right!
     
    Last edited: Sep 9, 2013
  5. Daniel Hood

    Daniel Hood Well-Known Member

    The rest of the Member controller uses
    Code:
    $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
     

Share This Page