So interestingly, I moved my main plugin file into a folder within the plugin directory. Where before the register_activation_hook worked perfectly well, it now does not work; however, the register_deactivation_hook still works perfectly, and it is currently being called from within the same file. I have attempted explicitly defining a path as well for the activation hooks instead of just relying on the __FILE__
keyword. Any insight that can be offered as to why the plugin no longer calls to hook on actviation would be much appreciated, thank you.
//define paths
$skirmish_table_name = $wpdb->prefix . 'skirmishes';
function skirmish_create_db() {
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
//* Create thetable
global $skirmish_table_name;
$sql = "CREATE TABLE $skirmish_table_name (
skirmish_id INTEGER NOT NULL AUTO_INCREMENT,
skirmish_SID TEXT NOT NULL,
skirmish_name TEXT NOT NULL,
skirmish_visibility TEXT NOT NULL,
skirmish_public_tries TEXT NOT NULL,
PRIMARY KEY (skirmish_id)
) $charset_collate;";
dbDelta( $sql );
}
register_activation_hook(__FILE__, 'skirmish_create_db' );
is the basic structure of the code.
As it turns out, I reverted the plugin back to its original format and the tables are still not being generated. I have attempted deactivating all of the plugins that had been activated previously, but it still seems that something is interfering with the plugin's ability to CREATE tables in the mysql database. Any insight into why this is going on would be much appreciated.
I have attempted checking all of the various logs, but cannot figure out what is going on. I have no idea why this is suddenly not working, when it was working perfectly well before. Either something is going on with the activation hook, or for some reason the server is rejecting/dropping the create table requests....