WordPress.org

Ready to get started?Download WordPress

Forums

DB Cache Reloaded Fix
DB Cache Reloaded Fix and User Spam Remover conflict (2 posts)

  1. kokopelli
    Member
    Posted 3 years ago #

    When I activate DB Cache Reloaded Fix on a site running the User Spam Remover plugin, I get an error in the latter:
    Catchable fatal error: Argument 1 passed to UserSpamRemover::__construct() must be an instance of wpdb, instance of dbrc_wpdb given, called in /home/mysite/public_html/wp-content/plugins/user-spam-remover/user-spam-remover.php on line 113 and defined in /home/mysite/public_html/wp-content/plugins/user-spam-remover/user-spam-remover.php on line 92

    If I deactivate DB Cache Reloaded Fix, the error goes away. I also posted about the problem here.

    Any ideas? Thanks.

    http://wordpress.org/extend/plugins/db-cache-reloaded-fix/

  2. Ivan Kristianto
    Member
    Plugin Author

    Posted 3 years ago #

    User Spam Remover use wpdb class in the it's constructor on line 92.
    Here is the quick fix, change the constructor (line 91) into this:

    // Constructor runs once only, since private and called only by getInstance()
      private function __construct() {
    	global $wpdb;
        self::$defaults['logDir'] = dirname(__FILE__).'/log';
    
        $this->wpdb = $wpdb;
    
        // initialize config vars from WordPress options table
        $this->timezone = get_option('timezone_string');
        foreach (self::$defaults as $key => $default) {
          $this->config[$key] = get_option(self::$wpOptGroup.$key, $default);
        }
      }

    Thanks

    Ivan

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic