Skip to:
Content
Pages
Categories
Search
Top
Bottom

on plugin activation, create table in db

  • @null

    Member

    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!

    _Null

Viewing 4 replies - 1 through 4 (of 4 total)
  • @livibetter

    Member

    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.

    @null

    Member

    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

    @livibetter

    Member

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

    http://dev.mysql.com/doc/refman/4.1/en/create-table.html

    Just create a table with IF NOT EXISTS.

    @null

    Member

    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