bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

on plugin deactivation...

(8 posts)
  • Started 1 year ago by Null
  • Latest reply from Null
  • This topic is not resolved

Tags:

  1. 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

    Posted 1 year ago #
  2. 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.

    Posted 1 year ago #
  3. I know that, this is just for testing purposes...

    Posted 1 year ago #
  4. I think there is a bug in the naming of the hooks....

    I've reported and patched it:

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

    Posted 1 year ago #
  5. 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?

    Posted 1 year ago #
  6. -double post-

    Posted 1 year ago #
  7. 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.

    Posted 1 year ago #
  8. I was affraid of that, any1 knows how to use this properly? An excample would be great!

    Thanks

    Posted 1 year ago #
  9. 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 :(

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.