2016-03-30, 06:10 PM
2016-03-30, 06:15 PM
Change the myawards_install function to this:
Edit: just noticed you got different columns. Have you added anything to it?
function my_awards_install()
{
global $mybb, $db, $templates;
if( !$db->table_exists( "myawards" ) )
{
$db->query( "CREATE TABLE ".TABLE_PREFIX."myawards (
awid smallint(4) NOT NULL auto_increment,
awname varchar(64) NOT NULL,
awimg varchar(64) NOT NULL,
awdescr varchar(255) NOT NULL,
PRIMARY KEY (awid)
) ENGINE=innodb;" );
}
if( !$db->table_exists( "myawards_users" ) )
{
$db->query( "CREATE TABLE ".TABLE_PREFIX."myawards_users (
id smallint(4) NOT NULL auto_increment,
awid smallint(4) NOT NULL,
awuid int(8) NOT NULL,
awreason varchar(255) NOT NULL,
awutime bigint(30),
PRIMARY KEY (id)
) ENGINE=innodb;" );
}
$db->query( "ALTER TABLE `".TABLE_PREFIX."users` ADD `awards` int(10) NOT NULL DEFAULT '0' AFTER `postnum`" );
$settings_group = array(
"gid" => "",
"name" => "myawards",
"title" => "My Awards",
"description" => "The My Awards settings group.",
"disporder" => "30",
"isdefault" => "0"
);
$db->insert_query( "settinggroups", $settings_group );
$gid = $db->insert_id();
$setting_1 = array(
"sid" => "",
"name" => "myawardsenable",
"title" => "Enable My Awards",
"description" => "Do you want to enable the awards system?",
"optionscode" => "onoff",
"value" => "1",
"disporder" => "1",
"gid" => intval( $gid )
);
$db->insert_query( "settings", $setting_1 );
myawards_upgrade_plugin();
}
Edit: just noticed you got different columns. Have you added anything to it?
2016-03-30, 06:23 PM
(2016-03-30, 06:15 PM)Sazze Wrote: [ -> ]Change the myawards_install function to this:
function my_awards_install() { global $mybb, $db, $templates; if( !$db->table_exists( "myawards" ) ) { $db->query( "CREATE TABLE ".TABLE_PREFIX."myawards ( awid smallint(4) NOT NULL auto_increment, awname varchar(64) NOT NULL, awimg varchar(64) NOT NULL, awdescr varchar(255) NOT NULL, PRIMARY KEY (awid) ) ENGINE=innodb;" ); } if( !$db->table_exists( "myawards_users" ) ) { $db->query( "CREATE TABLE ".TABLE_PREFIX."myawards_users ( id smallint(4) NOT NULL auto_increment, awid smallint(4) NOT NULL, awuid int(8) NOT NULL, awreason varchar(255) NOT NULL, awutime bigint(30), PRIMARY KEY (id) ) ENGINE=innodb;" ); } $db->query( "ALTER TABLE `".TABLE_PREFIX."users` ADD `awards` int(10) NOT NULL DEFAULT '0' AFTER `postnum`" ); $settings_group = array( "gid" => "", "name" => "myawards", "title" => "My Awards", "description" => "The My Awards settings group.", "disporder" => "30", "isdefault" => "0" ); $db->insert_query( "settinggroups", $settings_group ); $gid = $db->insert_id(); $setting_1 = array( "sid" => "", "name" => "myawardsenable", "title" => "Enable My Awards", "description" => "Do you want to enable the awards system?", "optionscode" => "onoff", "value" => "1", "disporder" => "1", "gid" => intval($gid) ); $db->insert_query( "settings", $setting_1 ); myawards_upgrade_plugin(); }
Wow, thanks so much! That worked!
Solved.
2016-03-30, 06:25 PM
(2016-03-30, 06:23 PM)Sinatra Wrote: [ -> ](2016-03-30, 06:15 PM)Sazze Wrote: [ -> ]Change the myawards_install function to this:
function my_awards_install() { global $mybb, $db, $templates; if( !$db->table_exists( "myawards" ) ) { $db->query( "CREATE TABLE ".TABLE_PREFIX."myawards ( awid smallint(4) NOT NULL auto_increment, awname varchar(64) NOT NULL, awimg varchar(64) NOT NULL, awdescr varchar(255) NOT NULL, PRIMARY KEY (awid) ) ENGINE=innodb;" ); } if( !$db->table_exists( "myawards_users" ) ) { $db->query( "CREATE TABLE ".TABLE_PREFIX."myawards_users ( id smallint(4) NOT NULL auto_increment, awid smallint(4) NOT NULL, awuid int(8) NOT NULL, awreason varchar(255) NOT NULL, awutime bigint(30), PRIMARY KEY (id) ) ENGINE=innodb;" ); } $db->query( "ALTER TABLE `".TABLE_PREFIX."users` ADD `awards` int(10) NOT NULL DEFAULT '0' AFTER `postnum`" ); $settings_group = array( "gid" => "", "name" => "myawards", "title" => "My Awards", "description" => "The My Awards settings group.", "disporder" => "30", "isdefault" => "0" ); $db->insert_query( "settinggroups", $settings_group ); $gid = $db->insert_id(); $setting_1 = array( "sid" => "", "name" => "myawardsenable", "title" => "Enable My Awards", "description" => "Do you want to enable the awards system?", "optionscode" => "onoff", "value" => "1", "disporder" => "1", "gid" => intval($gid) ); $db->insert_query( "settings", $setting_1 ); myawards_upgrade_plugin(); }
Wow, thanks so much! That worked!
Solved.
Happy to help.