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

Fixed XenForo_ControllerPublic_ProfilePost::getProfilePostSpecificRedirect

R

ragtek

Guest
#1
You've hardcoded the redirect type instead of using the $redirectType variable!


PHP:
public function getProfilePostSpecificRedirect(array $profilePost, array $user,
        $redirectType = XenForo_ControllerResponse_Redirect::SUCCESS
    )
    {
        if ($profilePost['post_date'] < XenForo_Application::$time)
        {
            $profilePostModel = $this->_getProfilePostModel();

            $conditions = $profilePostModel->getPermissionBasedProfilePostConditions($user) + array(
                'post_date' => array('>', $profilePost['post_date'])
            );

            $count = $profilePostModel->countProfilePostsForUserId($user['user_id'], $conditions);

            $page = floor($count / XenForo_Application::get('options')->messagesPerPage) + 1;
        }
        else
        {
            $page = 1;
        }

        return $this->responseRedirect(
            XenForo_ControllerResponse_Redirect::SUCCESS,
            XenForo_Link::buildPublicLink('members', $user, array('page' => $page)) . '#profile-post-' . $profilePost['profile_post_id']
        );
    }
That's why e.g
PHP:
    public function actionIndex()
    {
        $profilePostId = $this->_input->filterSingle('profile_post_id', XenForo_Input::UINT);
        list($profilePost, $user) = $this->getHelper('UserProfile')->assertProfilePostValidAndViewable($profilePostId);

        return $this->getProfilePostSpecificRedirect(
            $profilePost, $user, XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL_PERMANENT
        );
    }
won't be a RESOURCE_CANONICAL_PERMANENT redirect and why add-ons using these method will always get the XenForo_ControllerResponse_Redirect::SUCCESS redirect instead of a own(if it's selected)