wphooks.info - activate_{$plugin}

activate_{$plugin}

The hook occurs in the following 2 files

wp-admin/plugins.php:
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
				wp_die($valid);

			if ( ! WP_DEBUG ) {
				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
			}

			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
			// Go back to "sandbox" scope so we get the same errors as before
			plugin_sandbox_scrape( $plugin );
			/** This action is documented in wp-admin/includes/plugin.php */
			do_action( "activate_{$plugin}" );
			exit;

		case 'deactivate':
			if ( ! current_user_can('activate_plugins') )
				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));

			check_admin_referer('deactivate-plugin_' . $plugin);

			if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
wp-admin/includes/plugin.php:
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
			 * This hook is the "activation" hook used internally by register_activation_hook().
			 * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename.
			 *
			 * If a plugin is silently activated (such as during an update), this hook does not fire.
			 *
			 * @since 2.0.0
			 *
			 * @param bool $network_wide Whether to enable the plugin for all sites in the network
			 *                           or just the current site. Multisite only. Default is false.
			 */
			do_action( "activate_{$plugin}", $network_wide );
		}

		if ( $network_wide ) {
			$current = get_site_option( 'active_sitewide_plugins', array() );
			$current[$plugin] = time();
			update_site_option( 'active_sitewide_plugins', $current );
		} else {
			$current = get_option( 'active_plugins', array() );
			$current[] = $plugin;