TomNook08
Member
Posts: 52
Joined: Mar 2009
Reputation: 0
MyBux: 0
|
RE: Catalog System
New Problem!
When you click deactivate it doesn't remove anything from the MySQL DB and it doesn't remove the templates from MYBB and it keeps showing deactivate instead of activate...
Here is my current code:
PHP Code:
<?php /** * Plugin Copyright * TomNook08 of MyBBSource */
if(!defined("IN_MYBB")) { die("This file cannot be accessed directly."); } //Add Your Hooks $plugins->add_hook("member_profile_end", "catalog");
//REQUIRED function catalog_info() { return array( 'name' => 'Catalog', 'description' => 'Adds Items from the Animal Crossing games to the users profile.', 'website' => 'http://www.mybbsource.com', 'author' => 'TomNook08', 'authorsite' => 'mailto:[email protected]', 'version' => 'Beta 1', 'guid' => '', 'compatibility' => '1404',
); }
function catalog_activate() { global $db; $catalog_group = array( 'gid' => 0, 'name' => 'catalogadmin', 'title' => 'Catalog Admin', 'description' => 'Settings For The Catalog System.', 'disporder' => $rows+1, 'isdefault' => '0', );
$db->insert_query('settinggroups', $catalog_group); $gid = $db->insert_id();
$catalog_setting_1 = array( 'sid' => '0', 'name' => 'enablecatalog', 'title' => 'Enable Catalog System?', 'description' => 'If set to off, no one will get a catalog', 'optionscode' => 'onoff', 'value' => 'on', 'disporder' => 0, 'gid' => intval($gid), );
$catalog_setting_2 = array( 'sid' => '0', 'name' => 'showwhichgames', 'title' => 'Show Which Game', 'description' => 'Set to 1 to show only ACGC items, 2 to show only ACWW items, 3 to show ACCF/LGTTC items, or 0 for all 3 games', 'optionscode' => 'text', 'value' => '0', 'disporder' => 1, 'gid' => intval($gid), ); $catalog_setting_3 = array(
'sid' => '0', 'name' => 'adminitems', 'title' => 'Admin Remove Items?', 'description' => 'Do you want admins to be able to remove items?', 'optionscode' => 'onoff', 'value' => 'off', 'disporder' => 2, 'gid' => intval($gid), ); $db->query("CREATE TABLE `".TABLE_PREFIX."catalog` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `memberid` INT NOT NULL)"); $db->insert_query('settings', $catalog_setting_1); $db->insert_query('settings', $catalog_setting_2); $db->insert_query('settings', $catalog_setting_3); require MYBB_ROOT."/inc/adminfunctions_templates.php"; find_replace_templatesets("member_profile", '#{\$signature}#', "{\$signature}\n{\$member_catalog}"); $template = array( "title" => "member_catalog", "template" => "<head> <title>{\$mybb->settings[\'bbname\']} - Catalog</title> {\$headerinclude} </head> <body> {\$header} <table border=\"0\" cellspacing=\"{\$theme[\'borderwidth\']}\" cellpadding=\"{\$theme[\'tablespace\']}\" class=\"tborder\" style=\"clear: both;\"> <tr> <td class=\"thead\"><strong>My Catalog</strong></td> </tr> <tr> <td class=\"trow1\">{\$catalog}</td> </tr> </table> {\$footer} </body> </html> ", "sid" => -1 ); $db->insert_query("templates", $template); //stuff to do on activation of the plugin } function catalog_deactivate() { global $db; $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='catalogadmin'"); $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN( 'enablecatalog', 'showwhichgames', 'adminitems', )"); $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='member_catalog'"); $db->query("DROP TABLE ".TABLE_PREFIX."member_catalog"); require MYBB_ROOT."/inc/adminfunctions_templates.php"; find_replace_templatesets("member_profile", '#{\$member_catalog}(\r?)(\n?)#', '', 0); }
function catalog() { global $memprofile,$mybb,$theme,$db,$templates,$catalog; $enable=$mybb->settings['enablecatalog']; if ($enable != 'on') { return; } } //DO SOMETHING WHEN THE HOOK IS CALLED ?>
I'm an Animal Crossing Fanatic!!!
(Nintendo's Famous Game)
|
|