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

Profile Tab Routing

silence

Well-known member
#1
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($routePath, Zend_Controller_Request_Http $request, XenForo_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!
 

silence

Well-known member
#4
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:

Daniel Hood

Well-known member
#5
I don't think it's necessary. I am able to get my content displayed in the tab, I just don't know how to display the content FOR THAT USER (essentially how to get the users user_id and generate content from that)
The rest of the Member controller uses
Code:
$userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);