HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to set the default tab in the profile page


Is there a way to set the default tab in the profile page (yoursite.com/profile) , right now activity is the default tab. I wish to do this in a plugin



  • Options
    rloyolarloyola New
    edited November 2019

    I need this because we have custom content added as part of the profile page and profile tab and I want to have that tab selected as default when the profile page shows up. I was able to accomplish this by overriding the ProfileController Index in a plugin but I had a feeling its not a good thing. Does anyone knows how to do it the right way?

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    The most intuitive approach would be a rewrite rule but that wouldn't work. Profile routes look like that:

    • /profile
    • /profile/username
    • /profile/comments/username
    • /profile/comments

    So neither the first parameter after "/profile" nor the last parameter is always the username or the route. A rewrite rule therefore cannot be used 😐️

    The next approach I had thought about would have been hooking into the dispatcher or the controllers initialize method, but that didn't look like the best approach either.

    Therefore I think it is the best to do it that way:

       public function profileController_render_before($sender) {
           if ($sender->RequestMethod == 'index') {
               redirectTo(userUrl($sender->User, '', 'comments'));
  • Options


Sign In or Register to comment.