Make WordPress Core


Ignore:
Timestamp:
07/04/2005 09:53:26 PM (21 years ago)
Author:
ryan
Message:

register_activation_hook() and register_deactivation_hook(). Let's try these on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugins.php

    r2594 r2697  
    44if ( isset($_GET['action']) ) {
    55        check_admin_referer();
    6 
     6       
    77        if ('activate' == $_GET['action']) {
    88                $current = get_settings('active_plugins');
    99                if (!in_array($_GET['plugin'], $current)) {
    1010                        $current[] = trim( $_GET['plugin'] );
     11                        sort($current);
     12                        update_option('active_plugins', $current);
     13                        include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
     14                        do_action('activate_' . trim( $_GET['plugin'] ));
    1115                }
    12                 sort($current);
    13                 update_option('active_plugins', $current);
    1416                header('Location: plugins.php?activate=true');
    15         }
    16        
    17         if ('deactivate' == $_GET['action']) {
     17        } else if ('deactivate' == $_GET['action']) {
    1818                $current = get_settings('active_plugins');
    1919                array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
    2020                update_option('active_plugins', $current);
     21                do_action('deactivate_' . trim( $_GET['plugin'] ));
    2122                header('Location: plugins.php?deactivate=true');
    2223        }
Note: See TracChangeset for help on using the changeset viewer.