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

How to add a page to the user preferences thingy?

Discussion in 'XenForo Development Discussions' started by Liam W, Jun 19, 2013.

  1. Liam W

    Liam W Well-Known Member

    How would you add a page to the /account section?

    Namely, how would you add your page to the /account navigation, and link to it from the drop down tab?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    You extend the controller to add your action. And in 1.1, use template hooks to extend and add in your links, in 1.2, use the new template modifications to include your links.
     
  3. Liam W

    Liam W Well-Known Member

    Can I still do it with an existing controller and template? Can I add the sidebar to a template?
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    What?
     
    James likes this.
  5. James

    James Well-Known Member

    Extend XenForo/ControllerPublic/Account (god damn my underscore not working), add your new actionMyNewPage() and then do what you wish to do in that action.
     
  6. Liam W

    Liam W Well-Known Member

    But I already have a controller with a page that does everything, I just want to make it an account page and not a standalone page...
     
  7. xf_phantom

    xf_phantom Well-Known Member

    as @King Kovifor said, you just need to use the proxy system to extend the account controller and return your template via the _getWrapper method
     
  8. xf_phantom

    xf_phantom Well-Known Member

  9. Liam W

    Liam W Well-Known Member

    Yes, but like I said I have a standalone controller with all the code and bits and pieces already defined, and I also have extra actions such as /<node>/<data>/edit and /<node>/save etc. so how would I make this work for that?

    Ideally, I want to have it as /account/<current node> but how would I define my extra actions on top of /<node> etc?

    Liam
     
    Last edited: Jun 20, 2013
  10. xf_phantom

    xf_phantom Well-Known Member

    oh, that's for your paid addon.
    then i'm not going to help:p
     
  11. xf_phantom

    xf_phantom Well-Known Member

    no, just a joke

    as said already =>
    PHP:
    YourController extends the proxy of XenForo_ControllerPublic_Account{

    //your actions
    }
    use $this->_getWrapper for the return and add the links to the sidebar via the template change/merge/modification system
     
    Liam W likes this.
  12. Liam W

    Liam W Well-Known Member

    Right, but if I try and do /account/macros/1/edit (the one is data passed in), or /account/macros/save then it say's can't find action 'macros1edit' or so on - that isn't the action...

    (And I thought you were being serious, I only got your original reply in the email :p)
     
  13. Liam W

    Liam W Well-Known Member

    Did you delete your post @xf_phantom? I got an email about it...

    I guess I'll just use it as it is now then...

    Liam
     
  14. Jeremy

    Jeremy XenForo Moderator Staff Member

    If you are doing something advanced enough to have edit pages, saving, deleting, etc. its best left to its own route.
     
    Liam W, Bob and xf_phantom like this.
  15. xf_phantom

    xf_phantom Well-Known Member

    yes i deleted it

    i would just use a own route prefix because it's the fastest way
    adding something to the account route would require using a proxy class to extend the account route and and and....

    trust me, it's not worth to do this! just use a own routeprefix

    maybe it's possible in 1.2 with the new changes, but i have no idea:(
     
    Last edited: Jun 20, 2013
    Liam W and Bob like this.
  16. Liam W

    Liam W Well-Known Member

    I'll do that then :)
     

Share This Page