MyBB Community Forums

Full Version: PluginLibrary 13
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Use articlealerts (without _). _ is not allowed in a prefix for templates. That's just how MyBB works, the prefix is whatever comes before _ so in case of article_alerts, the prefix would be "article" only.
Thanks you, it's working now Smile
Hi frostchuz,

I write a plugin for MyBB and now I need to use PluginLibrary to make core edits.

For details, I need to replace this code in inc/function_users.php

$query = $db->simple_select("users", "usertitle,postnum", "uid='$uid'", array('limit' => 1));

with this

$query = $db->simple_select("users", "usertitle,level", "uid='$uid'", array('limit' => 1));


$query = $db->simple_select("usertitles", "title", "posts<='".$user['postnum']."'", array('order_by' => 'posts', 'order_dir' => 'desc'));


$query = $db->simple_select("usertitles", "title", "level<='".$user['level']."'", array('order_by' => 'level', 'order_dir' => 'desc'));

Then, what I should do now?
PluginLibrary 12 fixes a bug in the cache_delete() function, which didn't initialize a variable properly in greedy mode when there was nothing to delete, leading to a foreach() warning.
just out of curiosity is there a way to read the cache timestamp or cache time in order to check and expire cache?

Reasoning: My plugin gets the categories from WP, this would usually be something that is fairly static, so i want to cache these but rebuild the cache every day or so by re-grabbing the categories and rebuilding the cache
If it is going to be a fairly consistent rebuild then create a task to rebuild the cache. jmo
I was hoping to avoid the task route the plugin already has one task and i can't really mix this functionality with the other task. Worst comes to worst I can trot off another simple task and rebuild the cache daily.

I am thinking more and more that this plugin needs an admin interface beyond the settings, if that is the case then I may just put a "rebuild category cache" button in there that can handle this.

If you want a timestamp, you have to store it along with the cache. You have to expect the cache to vanish at any time (unlike MyBB's cache it's not database backed), so the codepoint where you read the cache also needs to be able to build it from scratch. If you want to refresh it periodically, you can simply check the timestamp in the same place. That's what I do in the overview plugin.
Hi Mate,

Thanks for that, that didn't even cross my mind Smile

Any idea what may cause this? I replaced class_moderation.php with a clean one from MyBB 1.6.10 package and it still happens.

Of course could do the edit manually and delete function from the Moderation Alerts plugin, but just wondering if it's a bug or what.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16