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

Where to Listen

Kovu

New member
#1
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:

Daniel Hood

Well-known member
#2
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.
 

Kovu

New member
#3
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.
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?
 

Daniel Hood

Well-known member
#4
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.