WordPress.org

Support

Support » Plugins and Hacks » Hacks » Create database table from plugin file

Create database table from plugin file

  • Josh
    Participant

    @josh401

    Hi,

    I would like to create a database entry, or an option entry, to check the install date of my plugin. Then, I would like to run a check after 1 week, 1 month, etc., to check if the plugin is still installed and active.

    Lastly, I would like to display a notice to the user that they have been using the plugin for “x” number of days. (This is for a donation nag notice)

    So, does anyone have any suggestions for this one? I know about the $wpdb global variable, and I know the basic CREATE function for databases.

    I suppose what I need to do is run an activation hook, inserting the current date into an option or database table (if it doesn’t already exist). Then, write another function to check the date (from that option) and only display an admin notice if the date is more than 7 or 30 days.

    So, I know about…

    $wbdb
    add_action (admin_notices)
    add_option and update_option

    Am I on the right track here? Or am I overlooking something which would make this much simpler?

    Thank you.

  • The topic ‘Create database table from plugin file’ is closed to new replies.