|
Easy way to remove settings
|
|
06-08-2010, 04:33 AM
(This post was last modified: 06-08-2010 04:34 AM by Steven.)
Post: #1
|
|||
|
|||
|
Easy way to remove settings
I'm currently rewriting my Advanced Forum Signatures plugin like I said I would ages ago (I got a job and haven't had much free time) and while doing so realized I could have done much better when deleting my plugin's settings when deactivating. Before it looked like this:
Code: $db->query("DELETE FROM `".TABLE_PREFIX."settings` WHERE `name`='afs_enabled'");Horrifying, right? Using SQL's LIKE and wildcards, I'm doing this in the new version: Code: $db->query("DELETE FROM `".TABLE_PREFIX."settings` WHERE `name` LIKE 'afs\_%'");Niiiiice. So next time you update your plugin/write a new one, remember this simple trick (if you're not already doing it). |
|||
|
06-08-2010, 10:30 AM
Post: #2
|
|||
|
|||
|
RE: Easy way to remove settings
That's pretty neat; thanks for the share.
![]() Photoshop Bliss V3 FREE - ACR Theme FREE |
|||
|
06-08-2010, 11:52 AM
Post: #3
|
|||
|
|||
|
RE: Easy way to remove settings
Thanks for the share mate.
Really helpfull
Facebook Connect for MyBB |
|||
|
06-08-2010, 12:19 PM
Post: #4
|
|||
|
|||
|
RE: Easy way to remove settings
I prefer this way:
PHP Code: function sample_info()PHP Code: function sample_activate()PHP Code: function sample_deactivate()You can use the same functions on every plugins. You just need to replace: PHP Code: $info = sample_info(); |
|||
|
06-08-2010, 01:18 PM
Post: #5
|
|||
|
|||
|
RE: Easy way to remove settings
Wow, I've been learning to make plugins a complete different way from you.
![]() Photoshop Bliss V3 FREE - ACR Theme FREE |
|||
|
06-08-2010, 04:42 PM
Post: #6
|
|||
|
|||
|
RE: Easy way to remove settings
Very handy, querschlaeger! I also used an array for the settings, but I think I'll stick to SQL for deactivation.
|
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)
Search
Member List
Calendar
Help


![[Image: 422.png]](http://internetometer.com/image/422.png)



![[Image: Ij9Y7.png]](http://i.imgur.com/Ij9Y7.png)