2010-02-27, 06:28 AM
(2010-02-27, 05:49 AM)TimB. Wrote: [ -> ]Which one, the original one in this thread or the one I posted code to in the post above yours?
is the download file in your OP the proper code to use? I want the best plugin.
(2010-02-27, 05:49 AM)TimB. Wrote: [ -> ]Which one, the original one in this thread or the one I posted code to in the post above yours?
(2010-02-27, 06:44 AM)TimB. Wrote: [ -> ]Sorry, I shouldn't have confused things, the code posted in post #8 is completely different and has nothing to do with this plugin. I merely posted it to benefit anyone following my discussion with Labrocca.
I'll move that code to another thread to prevent confusion.
(2010-02-27, 07:06 AM)Zomaian Wrote: [ -> ]Both work if you freaking read the thread that you would have figured out that both work only Labrocca's version uses less code.
(2010-01-05, 04:10 AM)TimB. Wrote: [ -> ]Can you (or anyone else) suggest a plugin that is a good example to study the source code of? I have a MyBB central subscription so either yours or someone elses. I am still a bit confused about what the correct way to modify a template with a plugin is.Mine! If you can understand them.
function smallquote_install(){
global $db, $mybb;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='smallquotecode'");
Indent your code - it helps readability.$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='smallquotecode'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='smallquotequote'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='smallquotesize'");
Although no-one cares about speed here, it just makes sense to shove it in one query... Whilst you're there, use MyBB's $db functions. You shouldn't be using $db->query for one, it should be $db->write_query, but in this case, you should be using $db->delete_query$db->delete_query("settings", "name IN ('smallquotecode', 'smallquotequote', 'smallquotesize')");
$db->insert_query("settings", $smallquote_setting_3);
}
You need to call rebuild_settings() to update MyBB's cached settings after modifying the settings table.