Fixed "Member Invited" state is responsible for "Group" NavTab on User Profile

Freelancer

Active Member
Bingo…. I found the "loading… bug" origin: :)

Once you invite a member to a group and he has not joined yet, the "Group" NavTab is displayed even if he is still in invite state only. Since he is not in a group at this time but invited, the "Group" NavTab appears and the "loading…" appears too, but of course nothing else happens, since he hasn't joined the group yet.

I propose that as long as the invite is pending the state of the "Group" NavTab is the same as if the user is in no group.

Took me a while to investigate the logic.
 
Good job :)

Open the file. Nobita/Teams/XenForo/ControllerPublic/Member.php

And replace all content by this:

PHP:
<?php

class Nobita_Teams_XenForo_ControllerPublic_Member extends XFCP_Nobita_Teams_XenForo_ControllerPublic_Member
{
    public function actionMember()
    {
        $GLOBALS['Team_fetchTeamRibbon'] = true;

        $response = parent::actionMember();
        if ($response instanceof XenForo_ControllerResponse_View AND !empty($response->params))
        {
            $params =& $response->params;

            $hasJoinAny = false;
            $teams = @unserialize($params['user']['team_cache']);
            if (is_array($teams))
            {
                foreach($teams as $team)
                {
                    if ($team['member_state'] == 'accept')
                    {
                        $hasJoinAny = true;
                        break;
                    }
                }
            }

            $params['user']['groupList'] = $hasJoinAny;
        }

        return $response;
    }

    public function actionCard()
    {
        $GLOBALS['Team_fetchTeamRibbon'] = true;

        return parent::actionCard();
    }

}

Does it fixed? :D
 
Good job :)

Open the file. Nobita/Teams/XenForo/ControllerPublic/Member.php

And replace all content by this:

PHP:
<?php

class Nobita_Teams_XenForo_ControllerPublic_Member extends XFCP_Nobita_Teams_XenForo_ControllerPublic_Member
{
    public function actionMember()
    {
        $GLOBALS['Team_fetchTeamRibbon'] = true;

        $response = parent::actionMember();
        if ($response instanceof XenForo_ControllerResponse_View AND !empty($response->params))
        {
            $params =& $response->params;

            $hasJoinAny = false;
            $teams = @unserialize($params['user']['team_cache']);
            if (is_array($teams))
            {
                foreach($teams as $team)
                {
                    if ($team['member_state'] == 'accept')
                    {
                        $hasJoinAny = true;
                        break;
                    }
                }
            }

            $params['user']['groupList'] = $hasJoinAny;
        }

        return $response;
    }

    public function actionCard()
    {
        $GLOBALS['Team_fetchTeamRibbon'] = true;

        return parent::actionCard();
    }

}

Does it fixed? :D
NobitaDoes it work?
 
I did as you said, although it is only half of the code that was there before… o_O When I try to invite a member I get an error…

The following error occurred:
An unexpected error occurred. Please try again later.

:(

and the following server Error is logged:

Code:
Error Info
XenForo_Exception: Cannot load class using XFCP. Load the class using the correct loader first. - library/XenForo/Autoloader.php:108
Generated By: Unknown Account, 1 minute ago
Stack Trace
#0 [internal function]: XenForo_Autoloader->autoload('XFCP_Nobita_Tea...')
#1 /var/www/clients/client180/web812/web/library/Nobita/Teams/ControllerPublic/Member.php(4): spl_autoload_call('XFCP_Nobita_Tea...')
#2 /var/www/clients/client180/web812/web/library/XenForo/Autoloader.php(119): include('/var/www/client...')
#3 /var/www/clients/client180/web812/web/library/XenForo/Application.php(1050): XenForo_Autoloader->autoload('Nobita_Teams_Co...')
#4 /var/www/clients/client180/web812/web/library/XenForo/Application.php(465): XenForo_Application::autoload('Nobita_Teams_Co...')
#5 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(458): XenForo_Application::resolveDynamicClass('Nobita_Teams_Co...', 'controller')
#6 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(343): XenForo_FrontController->_getValidatedController('Nobita_Teams_Co...', 'Invite', Object(XenForo_RouteMatch))
#7 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /var/www/clients/client180/web812/web/index.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
  ["url"] => string(53) "https://www.xxxxxxxxxxxxxxx.com/groups/members/invite"
  ["_GET"] => array(1) {
    ["/groups/members/invite"] => string(0) ""
  }
  ["_POST"] => array(6) {
    ["username"] => string(20) "Invited Member Name"
    ["_xfToken"] => string(8) "********"
    ["team_id"] => string(1) "7"
    ["_xfRequestUri"] => string(27) "/groups/chapter-2.7/members"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

[I masked the website and member name for privacy purposes]
 
I did as you said, although it is only half of the code that was there before… o_O When I try to invite a member I get an error…



:(

and the following server Error is logged:

Code:
Error Info
XenForo_Exception: Cannot load class using XFCP. Load the class using the correct loader first. - library/XenForo/Autoloader.php:108
Generated By: Unknown Account, 1 minute ago
Stack Trace
#0 [internal function]: XenForo_Autoloader->autoload('XFCP_Nobita_Tea...')
#1 /var/www/clients/client180/web812/web/library/Nobita/Teams/ControllerPublic/Member.php(4): spl_autoload_call('XFCP_Nobita_Tea...')
#2 /var/www/clients/client180/web812/web/library/XenForo/Autoloader.php(119): include('/var/www/client...')
#3 /var/www/clients/client180/web812/web/library/XenForo/Application.php(1050): XenForo_Autoloader->autoload('Nobita_Teams_Co...')
#4 /var/www/clients/client180/web812/web/library/XenForo/Application.php(465): XenForo_Application::autoload('Nobita_Teams_Co...')
#5 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(458): XenForo_Application::resolveDynamicClass('Nobita_Teams_Co...', 'controller')
#6 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(343): XenForo_FrontController->_getValidatedController('Nobita_Teams_Co...', 'Invite', Object(XenForo_RouteMatch))
#7 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /var/www/clients/client180/web812/web/index.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
  ["url"] => string(53) "https://www.xxxxxxxxxxxxxxx.com/groups/members/invite"
  ["_GET"] => array(1) {
    ["/groups/members/invite"] => string(0) ""
  }
  ["_POST"] => array(6) {
    ["username"] => string(20) "Invited Member Name"
    ["_xfToken"] => string(8) "********"
    ["team_id"] => string(1) "7"
    ["_xfRequestUri"] => string(27) "/groups/chapter-2.7/members"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

[I masked the website and member name for privacy purposes]
FreelancerPost full trace here.
 
Error Info
XenForo_Exception: Cannot load class using XFCP. Load the class using the correct loader first. - library/XenForo/Autoloader.php:108
Generated By: Unknown Account, 17 minutes ago
Stack Trace
#0 [internal function]: XenForo_Autoloader->autoload('XFCP_Nobita_Tea...')
#1 /var/www/clients/client180/web812/web/library/Nobita/Teams/ControllerPublic/Member.php(4): spl_autoload_call('XFCP_Nobita_Tea...')
#2 /var/www/clients/client180/web812/web/library/XenForo/Autoloader.php(119): include('/var/www/client...')
#3 /var/www/clients/client180/web812/web/library/XenForo/Application.php(1050): XenForo_Autoloader->autoload('Nobita_Teams_Co...')
#4 /var/www/clients/client180/web812/web/library/XenForo/Application.php(465): XenForo_Application::autoload('Nobita_Teams_Co...')
#5 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(458): XenForo_Application::resolveDynamicClass('Nobita_Teams_Co...', 'controller')
#6 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(343): XenForo_FrontController->_getValidatedController('Nobita_Teams_Co...', 'Invite', Object(XenForo_RouteMatch))
#7 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /var/www/clients/client180/web812/web/index.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
["url"] => string(53) "https://www.xxxxxxxxxxxxxx.com/groups/members/invite"
["_GET"] => array(1) {
["/groups/members/invite"] => string(0) ""
}
["_POST"] => array(6) {
["username"] => string(20) "Invited Member Name"
["_xfToken"] => string(8) "********"
["team_id"] => string(1) "7"
["_xfRequestUri"] => string(27) "/groups/chapter-2.7/members"
["_xfNoRedirect"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
 
Back
Top