WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
[resolved] [Plugin: Contact Form 7 to Database Extension] Fatal error: Call to undefined method dbrc_wpdb::set_ (6 posts)

  1. Claudio Sanches
    Member
    Posted 2 years ago #

    Fatal error: Call to undefined method dbrc_wpdb::set_charset() in public_html/wp-content/plugins/contact-form-7-to-database-extension/CFDBQueryResultIterator.php on line 119

    http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/

  2. Michael Simpson
    Member
    Plugin Author

    Posted 2 years ago #

    What version of WP are you running? Is is pre-3.1.0?

  3. Claudio Sanches
    Member
    Posted 2 years ago #

    WordPress 3.2.1 and Contact Form 7 to Database Extension 2.2.1.

  4. Michael Simpson
    Member
    Plugin Author

    Posted 2 years ago #

    Would you try this: Edit the plugin file CFDBQueryResultIterator.php

    Find this code starting line 116

    // Target charset is in wp-config.php DB_CHARSET
            if (defined('DB_CHARSET') && 'DB_CHARSET' != '') {
                global $wpdb;
                $wpdb->set_charset($con,
                                   DB_CHARSET,
                                   (defined('DB_COLLATE') && 'DB_COLLATE' != '') ? DB_COLLATE : null);

    Replace with:

    // Target charset is in wp-config.php DB_CHARSET
            if (defined('DB_CHARSET')) {
                if (DB_CHARSET != '') {
                    global $wpdb;
                    if (method_exists($wpdb, 'set_charset')) {
                        $collate = null;
                        if (defined('DB_COLLATE')) {
                            if (DB_COLLATE != '') {
                                $collate = DB_COLLATE;
                            }
                        }
                        $wpdb->set_charset($con, DB_CHARSET, $collate);
                    }
                    else {
                        $setCharset = 'SET NAMES \'' . DB_CHARSET . '\'';
                        if (defined('DB_COLLATE')) {
                            if (DB_COLLATE != '') {
                                $setCharset = $setCharset . ' COLLATE \'' . DB_COLLATE . '\'';
                            }
                        }
                        mysql_query($setCharset, $con);
                    }
                }
  5. Claudio Sanches
    Member
    Posted 2 years ago #

    it works, thank you.

  6. Michael Simpson
    Member
    Plugin Author

    Posted 2 years ago #

    Great. I'll push out that change in an update so everyone gets it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic