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

Hi how can I extend the XenForo_Visitor?

Discussion in 'XenForo Development Discussions' started by Uniphix, Oct 29, 2011.

  1. Uniphix

    Uniphix Active Member

    Is there a best way to extend the XenForo_Visitor??? The reason is I need to add more things to the XenForo_Visitor and I would hate to have to modify and merge it it on each XenForo Update... Basically I need to add permissions that I can use for caching...
     
  2. Uniphix

    Uniphix Active Member

    No one has any ideas on how to do this?
     
  3. digitalpoint

    digitalpoint Well-Known Member

    You can't because XenForo_Visitor is mostly a group of static methods that are called directly (not through a loader). The only way to extend it/change existing methods would be if it was loaded through a class loader. If your permissions stuff is just something you need for own stuff, you could make your own class that just extends XenForo_Vistor, and call that class when you need the extra stuff.
     
  4. Fuhrmann

    Fuhrmann Well-Known Member

    You can use the Code Event Listener visitor_setup, dont?
     
  5. digitalpoint

    digitalpoint Well-Known Member

    Oh yeah... if you want to do something with the visitor OBJECT, you can do it that way... I thought you wanted to extend the visitor class/methods though.
     
  6. Uniphix

    Uniphix Active Member

    I did, I just created my own Visitor class without having to extend it, Then whenever I need to access that class I can, I make it static like the visitor class itself and then cache etc. anything that I need. It ended up working the best way. Thanks everyone who tried to help =).

    Ben
     
    digitalpoint and Fuhrmann like this.

Share This Page