MyBB Community Forums

Full Version: [Release] Small quotes and code blocks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(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.
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, 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.

very nice plugin..sure shortens up a page when people quote other posts.
Nice, seems like a nice practice plugin but to be honest a bit useless. You can change it as easy by going in the CSS. Maybe create an plugin that allows people to edit more than just the codeblock and quoteblock? Could be a great plugin for people that are clueless about CSS Wink.
sorry the plug-in at the top i was referring to, does it still have 3 queries? or is that been fixed since?
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-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.

getting a bit tired here, forgive me (2:11am) Sleepy
Just use Labrocca's method, I really just made this to learn more about plugin authoring. I probably should make a few minor changes to this so it doesn't make any unnecessary queries though for anyone who is using it.
(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.

Anyway, my criticisms:
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.
Of course, same applies to your uninstall function.


Performance wise, it would actually probably be more efficient for the plugin to output CSS rather than parse posts for replacements, but that's your decision.
Thanks for the feedback Yumi, your plugins are a great example, I'm looking through them now. I'll try and include all this when I write the next version of my stop forum spam plugin.
Pages: 1 2