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

Where to Listen

Discussion in 'XenForo Development Discussions' started by Kovu, Jul 31, 2014.

  1. Kovu

    Kovu New Member

    I'm currently developing a plugin which interfaces with PostRatings, which will give certain users XXX when they reach a certain amount of votes. I know I need to access PostRatings' database, but I'm not sure when or where to do so.

    If you're still confused, say a user hits 50 Creative votes. They are awarded with something, but I'm not sure where I'd listen for the 50 creative votes.
     
    Last edited: Jul 31, 2014
  2. Daniel Hood

    Daniel Hood Well-Known Member

    You'd probably be best suited making it a cron entry similar to how trophies work. You could hook into the datawriter and check on every vote if it makes them hit the criteria but that'd be a huge performance no-no.
     
  3. Kovu

    Kovu New Member

    I was worried about the performance impact, thanks for the suggestion.

    After searching through the forums however, there doesn't seem to be a reference to a way to create a new cron using code. Am I simply not understanding how crons work? They're just automated tasks correct?
     
  4. Daniel Hood

    Daniel Hood Well-Known Member

    They're just classes with a static method. You go to the tools section of the admin panel, select cron entries, then filll out the form with your class::method() and put all the logic in there.

    I recommend looking at the /library/XenForo/CronEntry/ files to see how XenForo does it.
     

Share This Page