nkoenig
Forum Replies Created
-
Forum: Plugins
In reply to: Adding a hook for custom plugin activationI’ve tried both solutions and I cannot make it work, I could really use some hint here:
I’ve tried:
add_action(‘activate_folder/plugin.php’, ‘function’);
and also:
$myrelpath = preg_replace(‘.*wp-content.plugins.’,”,__FILE__);
add_action(‘activate_’.$myrelpath,’function’);But it seems that my function for installing my SQL TABLES
doesn’t get initiated. Is there something that I’m missing?
I have read CREATING TABLES WITH PLUGINS, but nothing seems to help.I have put my install-function in its own php-file and placed it in ../plugins/ along with my plogin.php file.
Forum: Plugins
In reply to: activate plugin function WP 2.0 (development)UPS, sorry Im a newbe:
function my_install() {
global $wpdb;$sql = “CREATE TABLE my_images (
id MEDIUMINT(9) AUTO_INCREMENT,
content TEXT,
PRIMARY KEY (id),
);”;require_once(ABSPATH . ‘wp-admin/upgrade-functions.php’);
dbDelta($sql);
}add_action(‘activate_my_plugin.php’,’my_install’);
BUT it still doesn’t work?
Forum: Plugins
In reply to: activate plugin function WP 2.0 (development)To be more specific this is what I try, but I cannot get it to work. My plugin “myplugin.php” is ofcourse placed in
/plugins/myplugin.phpand my install.php is placed in the same directory.
This is the code:function my_install() {
global $wpdb;
$wpdb->show_errors();$sql = “CREATE TABLE myTable (
id MEDIUMINT(9) AUTO_INCREMENT,
content TEXT,
PRIMARY KEY (images_id), );”;require_once(ABSPATH . wp-admin/upgrade-functions.php’);
dbDelta($sql);
}add_action(‘activate_myplugin.php’, ‘my_install’);
Forum: Plugins
In reply to: activate plugin function WP 2.0 (development)Im trying to use:
add_action(‘activate_your-plugin.php’,’lgoodbar_function’);
But I must do something wrong cause nothing works.
Im trying to create tables and I’ve read all about $wpdb and how to use activate_ hook to trigger my install.php when plugin installed. Maybe I type in the wrong pluginurl or maybe I put my install.php the wrong place. Can someone please help me with an example or maybe a hint about how to debug my installer.