Ask user permission when activating a plugin

Try the following code: add_action( ‘admin_head’, ‘ask_for_activation’ ); function ask_for_activation() { ?> <script type=”text/javascript”> jQuery(function($){ $(‘span.activate a’).click(function(e){ var c = confirm(‘Are you sure wnat to activate?’) if(!c) { e.preventDefault(); return false; } return true; }); }); </script> <?php } You can add those codes in your functions.php in the theme, if you think your theme … Read more

why creating tables using $wpdb is not being executed while installing plugins?

Try using a different method. WordPress fires a hook during plugin activation activate_yourplugin/filename.php. You can use this to create tables. function creating_order_tables() { if(!get_option(‘tables_created’, false)) { global $wpdb; $ptbd_table_name = $wpdb->prefix . ‘printtextbd_order’; if ($wpdb->get_var(“SHOW TABLES LIKE ‘”. $ptbd_table_name .”‘” ) != $ptbd_table_name ) { $sql=”CREATE TABLE exone( customer_id INT(20) AUTO_INCREMENT, customer_name VARCHAR(255), order_type VARCHAR(255), … Read more

Register theme customizer settings when theme activates [duplicate]

You need only use the default value on the wp_customize and that is all $wp_customize->add_setting(‘mytextoption’, array( ‘default’ => ‘defaultvalue’, ‘capability’ => ‘edit_theme_options’, ‘type’ => ‘option’, replace defaultvalue for the value you want, and when the user activate the theme this line will register the default value on the DB only when not exist on the … Read more

Remote plugin activation hook

Use activate_plugin() instead: activate_plugin( $plugin, $redirect=””, $network_wide = false, $silent = false ) You need just the first parameter, the same value as in the option. This function will call the necessary actions: if ( ! $silent ) { do_action( ‘activate_plugin’, $plugin, $network_wide ); do_action( ‘activate_’ . $plugin, $network_wide ); } Note: depending on where … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)