WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
[resolved] CF7 and CFDB - not saving submissions (8 posts)

  1. ninjagowoo
    Member
    Posted 3 years ago #

    My form submissions are no longer being saved by CFDB after updating. I am running:

    WP: 3.1.3
    CF7: 2.4.5
    CFDB: 1.8.7

    In my PHP error log I am seeing a lot of

    WordPress database error Table '[dbnameremitted].wp_CF7DBPlugin_SUBMITS' doesn't exist for query INSERT INTO wp_CF7DBPlugin_SUBMITS (`....

  2. ninjagowoo
    Member
    Posted 3 years ago #

    It looks like this issue was caused by a rename of the cfdb plugin database. Somewhere in the upgrade map the database name went from 'wp_cf7dbplugin_submits' to 'wp_CF7DBPlugin_SUBMITS'. Since the plugin upgrade process did not address this, submitted form data was lost cause it was trying to use the wrong database name.

    To address this functionality I had to delete the plugin entirely and re-install a fresh copy to generate a new database.

    Hope this helps someone along the line.

  3. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    The plugin always uses 'wp_CF7DBPlugin_SUBMITS' with that exact case. It has never been renamed nor does an upgrade change it. I don't know how your table name would have been converted to lower case.

  4. ninjagowoo
    Member
    Posted 3 years ago #

    Wow that is very odd then. I haven't a clue myself.

  5. afinno
    Member
    Posted 3 years ago #

    OK guys. Neither of you are technically in the wrong here but there is an issue.

    At our work we develop on multiple operating systems. One of our developers works on a Windows machine under WAMP, I develop on OSX under MAMP and we deploy all of our apps on to a CentOS server (LAMP).

    Now the issue, which i wasn't aware of until trying to troubleshoot this problem, is that when you create tables from a php script on a windows machine running WAMP, for some reason, it forces all table names to lower case. I have tested and confirmed this. This means that when you go to dump the database to a unix based system for
    deployment it stays as lower case but the php script is still looking for the upper case characters.

    As windows isn't case sensitive this isn't an issue, however all unix based systems are. So, if you never cross over operating systems when you are developing with wordpress (or anything else really) you'll never have this problem.

    Best thing to do would be to ensure you always develop with this in mind, especially when creating your tables. Very annoying but an unfortunate fact at the moment.

    TL;DR - when creating a wordpress plugin it's best to name all of your tables in lower case.

    EDIT: This is how we solved our problem. We modified CF7DBPlugin.php...

    FROM:
    Line 615: return $this->prefixTableName('SUBMITS');

    TO:
    Line 615: return strtolower($this->prefixTableName('SUBMITS'));

    This might not work for everyone but it definitely fixes our problem.

  6. ninjagowoo
    Member
    Posted 3 years ago #

    I was suspicious of such a thing... thank you for confirming and providing your fix.

  7. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    I plan to make the upgrade the next version (post 1.8.8) changed the table name to all lower case to avoid this problem. Thanks for figuring it out.

  8. afinno
    Member
    Posted 3 years ago #

    No Problem. I wouldn't think that a lot of people have this issue but it's probably a good thing to be aware of regarding operating systems in general.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic