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

Only allow plugin to be activated on root site of multisite

You could check if the constant SITE_ID_CURRENT_SITE matches get_current_site()->id. The following does this for the activation. During runtime you have to check it again. register_activation_hook( __FILE__, ‘force_main_site_installation’ ); function force_main_site_installation() { if ( defined( ‘SITE_ID_CURRENT_SITE’ ) and SITE_ID_CURRENT_SITE !== get_current_site()->id ) { if ( function_exists(‘deactivate_plugins’) ) { deactivate_plugins( __FILE__ ); } die( ‘Install this plugin … Read more

Problem creating a table with dbDelta

if( $installed_ver != $simple_location_version ) { on first run, $installed_ver is an empty string and $simple_location_version is NULL, so this inequality test will fail and your SQL will never be executed. if you check for strict inequality, it will work: if( $installed_ver !== $simple_location_version ) {

Redirect after User Activation [closed]

Paste this code in your bp-custom.php file or, if you prefer, your active theme’s functions.php file: add_action( ‘bp_core_activated_user’, ‘wpse_70289_activated_user_redirect’ ); function wpse_70289_activated_user_redirect( $user_id ) { $registered_from = get_user_meta( $user_id, ‘registered_from’, true ); wp_redirect( $registered_from ); } I haven’t tested this code myself yet, but it should work just fine. References: http://codex.wordpress.org/Function_Reference/get_user_meta http://codex.wordpress.org/Function_Reference/wp_redirect

Function to activate WordPress theme inside a plugin

Of course there’s a function for that (Codex): switch_theme( $stylesheet ) It: Switches current theme to new template and stylesheet names. Accepts one argument: $stylesheet of the theme. ($stylesheet is the name of your folder slug. It’s the same value that you’d use for a child theme, something like twentythirteen.) It also accepts an additional function signature … Read more

File not found.