Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.

How to set the default tab in the profile page

Hi

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

Thanks

Comments

  • rloyolarloyola New
    edited November 24

    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?

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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'));
           }
       }
    


    rloyola
  • Thanks

Sign In or Register to comment.