MyBB Community Forums

Full Version: Hooks after a mod action runs.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi, i'm working on making a latest posts plugin that doesn't completely suck (see this lmao), and basically it stores the threads in cache (i'm using redis not that that matters), so i need to update the cache whenever the latest posts change, eg. the posts/threads get deleted or something.

i've tried the following hooks, but for some reason they run before the action takes place and i get the results for before the action takes place.

[Image: zjibdz.png]

is there like, a way i can hook into whenever a post changes or something?
Where does that query come from? If that's stock MyBB you should report a bug.

Quote:so i need to update the cache whenever the latest posts change

You could simply set an invalid flag for the cache there and update it later when actually someone wants to know...
(2016-05-17, 11:22 AM)frostschutz Wrote: [ -> ]Where does that query come from? If that's stock MyBB you should report a bug.
it's some plugin for latest posts that was really slow

Quote:
Quote:so i need to update the cache whenever the latest posts change

You could simply set an invalid flag for the cache there and update it later when actually someone wants to know...
that's a really good idea, thanks.

in the end i added my own hook to log_moderator_action(), which has worked perfectly so far. but if i was developing the plugin for use in more than one forum, i'd definitely go with what you suggested.
I was also going to suggest just using the core_edit() feature of PluginLibrary and add your own hook in manually where you needed it to run. Would be a pretty simple core edit and it wouldn't break anything I don't think.