When I was done. I'm going to redo the whole thing.Should you point out at which step this error happened?
When I was done. I'm going to redo the whole thing.Should you point out at which step this error happened?
I need to create a database field when the add-on is installed, what do I have to do? I have created an "Installer.php" file, created call-back class and methods but cant seem to work.
Thanks
protected static $table = array(
'createQuery' => 'CREATE TABLE IF NOT EXISTS `xf_my_table` (
`mytable_id` int(10) NOT NULL AUTO_INCREMENT,
`other_field` VARCHAR( 50 ) NOT NULL ,
`other_2_field` VARCHAR( 50 ) NOT NULL ,
`other_3_field` VARCHAR( 50 ) NOT NULL ,
PRIMARY KEY (`mytable_id`)
) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;',
'dropQuery' => 'DROP TABLE IF EXISTS `xf_my_table`'
);
public static function install()
{
//We get here the instance of the XenForo db.
$db = XenForo_Application::get('db');
//Tell the db to query our 'createQuery'.
$db->query(self::$table['createQuery']);
}
public static function uninstall()
{
//We get here the instance of the XenForo db.
$db = XenForo_Application::get('db');
//Tell the db to query our 'dropQuery', because we are uinstalling.
$db->query(self::$table['dropQuery']);
}
okay... it works... the only thing I changed was "$table" to something else, was that the problem?
oh sorry... I also changed createQuery and dropQuery... thats the problem?
and everything was same-to-same... weird... oh well might have missed somethingNot. I just post it this way, using "dropQuery" and "createQuery" because this is how I use it in all my add-ons. Just make sure, again, to change in the both function too.
and everything was same-to-same... weird... oh well might have missed something
yes, as I have mentioned earlierBut you can get it to work now?
okay... it works... the only thing I changed was "$table" to something else, was that the problem?
yes, as I have mentioned earlier
I just wanted to thank you for this, Lawrence. I found it very informative, and I'm really happy someone wrote something like this. Thanks again. =]
We can leave this function blank until we create a new options group in the AdminCP. If you are following along with each part, you can turn off this Add-on until we add in the code:
AdminCP home, and uncheck the Add-on Limit Signatures for new Members.
We use essential cookies to make this site work, and optional cookies to enhance your experience.