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

search_start Listener

Discussion in 'XenForo Development Discussions' started by dbembibre, Jul 11, 2013.

  1. dbembibre

    dbembibre Active Member

    Sorry if is a stupid question, im not a programmer, but i cant found this.
    Im trying to migrate my own vb3 plugin to restrict to certain groups the search function when the server load is high. In vb have a "search_start" hookname, exist something similar in xf ??

    Thanks a lot for you patience with my questions :D
  2. tyteen4a03

    tyteen4a03 Well-Known Member

    XenForo does not use a hooking system. Instead, you directly override classes.

    Override XenForo_ControllerPublic_Search::actionIndex() and actionSearch() and add your SLA checking code there. If you need starter boilerplate code let me know - I assume you know how to extend existing classes correctly :)
    dbembibre likes this.
  3. dbembibre

    dbembibre Active Member

    Thanks a lot @tyteen4a03 yes i know how to extend the existing classes, but not what classes need to extend :D
  4. tyteen4a03

    tyteen4a03 Well-Known Member

    XenForo's code is very developer friendly. If you have basic knowledge in MVC you should be able to find the class you need instantly.

    Class names also match directory structure, so XenForo_ControllerPublic_Search exists under library/XenForo/ControllerPublic/Search.php as you would expect.
    dbembibre likes this.
  5. dbembibre

    dbembibre Active Member

    Great to know, i migrate a month ago from vb3.8 and im a little lost :) i release my first two little addons yesterday, but following the development tutorials :)
    Last edited: Jul 11, 2013
    tyteen4a03 likes this.
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    If you have debug enabled, you are also able to go directly to the routes to find the RoutePrefix which will in turn show you the controller that is being used.
    dbembibre likes this.

Share This Page