Skip to:
Content
Pages
Categories
Search
Top
Bottom

on plugin deactivation…

  • Hi,

    There is a hook so that, on plugin deactivation, you can do an action. In my case, I want to drop a table when the plugin is deactivated.

    I can’t seem to get it to work. What am I missing?

    The code:

    function bb_deactivate_bbmenu() {
    bb_register_deactivation_hook( bbmenu.php, 'drop_bbmenu_table' );
    }

    do_action( 'bb_deactivate_bbmenu' . $plugin );

    function drop_bbmenu_table() {
    global $bbdb;

    $query = "DROP TABLE <code>$bbdb->menu</code>";

    $bbdb->query( $query );
    }

    Also where does $plugin come from? Do I need to set it or does it grab the plugin’s name? And same about __file__ I used the plugins php file for this. Is this correct?

    Some help plz

Viewing 8 replies - 1 through 8 (of 8 total)
  • I wouldn’t drop the table when you deactivate the plugin… what if I’m using the plugin and want to temporarily deactivate it? I’d lose all the data.

    I know that, this is just for testing purposes…


    Sam Bauers
    Participant

    @sambauers

    I think there is a bug in the naming of the hooks….

    I’ve reported and patched it:

    https://trac.bbpress.org/ticket/717

    So I accedentily discovered a bug? :p Is the rest of my code correct? And how about: on plugin activation? Perhaps it has the same issue?

    -double post-


    Sam Bauers
    Participant

    @sambauers

    I don’t think your code was correct in any case. But I’m not sure what the correct procedure is.

    Apply the patch in the ticket (or make the changes manually) and try again.

    I was affraid of that, any1 knows how to use this properly? An excample would be great!

    Thanks

    Any 1 can give me a wroking excample to activate a function on plugin activation and 1 on plugin deactivation?

    I want to create a table on plugin activation. There is a hook, but don’t know how to use it :(

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar