Skip to:

on plugin activation, create table in db

  • Hi,

    There is a hook so at plugin activation you can put some data in your database. Does any1 got this working? I can’t get it to work!


Viewing 4 replies - 1 through 4 (of 4 total)
  • Here is an example for deactivation hook

    //bb_register_deactivation_hook(__FILE__, 'GADeactivate'); // Bug in bbPress 0.8.3, do same thing using next line
    add_action('bb_deactivate_plugin_' . bb_plugin_basename(__FILE__), 'GADeactivate');

    just remove “de” from above, that should work. For example,

    bb_register_activation_hook(__FILE__, 'hook_fct');

    However, I haven’t used activation hook, therefore I don’t know is there a problem with it.

    Euuh ok, still not sure how to use this.

    Let’s say I want to ad a tabel in the db called ‘test’, but only if it doesn’t excist.

    So on plugin activation:

    1- check if the table ‘test’ excists

    2- if not, insert the tabel ‘test’

    3- else die

    You don’t have to check the existence of the table you need

    Just create a table with IF NOT EXISTS.

    Without the [ ] I presume. Thx going to try that!

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