Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] Small quotes and code blocks
#11
(02-27-2010, 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.
Reply
#12
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.
Reply
#13
(02-27-2010, 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.
Reply
#14
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.
Reply
#15
sorry the plug-in at the top i was referring to, does it still have 3 queries? or is that been fixed since?
Reply
#16
Both work if you freaking read the thread that you would have figured out that both work only Labrocca's version uses less code.
Reply
#17
(02-27-2010, 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
Reply
#18
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.
Reply
#19
(01-05-2010, 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.
Reply
#20
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)