• Resolved felr

    (@felr)


    Hello,

    I could install WP Statistics just fine on one of my sites and it works great, a great plugin really!

    However, on another site (on the same server, but different MySQL databases and a different virtual server) the plugin uses the correct WP table prefix during setup, but when accessing the “WP Statistics” menu item in the admin panel, the plugin says that “Plugin tables do not exist in the database! Please re-run the install routine.” Of course, that doesn’t help, as doesn’t deactivating and reactivating the plugin. I have no other issues with plugins not using the correct table prefix, it just happens with “WP Statistics”. Any idea on how to fix that?

    https://ww.wp.xz.cn/plugins/wp-statistics/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Greg Ross

    (@gregross)

    If you go in to the Statistics->Optimization page, what do the table names show up as in the “Number of rows in the” lines?

    If you look at your database tables (through phpMySQL) do the statistics tables exist and if so what are their names?

    Thread Starter felr

    (@felr)

    Thanks for the quick response! The tables have been created correctly and can as such be found in the database, but furtheron, WP Statistics is referring to them with an INCORRECT prefix (and doesn’t collect statistical data either, I verified that in the tables within the database). I have not the slightest idea where it’s coming from, this string is not contained in any of my WP-related sources or as far as I can see, in the database.

    EDIT: I found where the error is originating from. One other Plugin I’m using (WP2BB, https://ww.wp.xz.cn/plugins/wp2bb/) includes the main configuration file of PHPBB, config.php, which also contains a $table_prefix variable – that seems to overwrite it for your plugin. When I deactivate the other plugin, ‘WP Statistics’ is working fine. However, I’d like to use both! ;-))

    The interesting thing is: doing a quick search through the code, I found that WP just as a few other plugins are also using a seemingly global $table_prefix variable, but I never had any problems (also using the aforementioned PHPBB-related plugin) before, so they seem to handle it differently than your plugin.

    Plugin Contributor Greg Ross

    (@gregross)

    Both $table_prefix and $wpdb->prefix should be able to be used, I don’t know what WP2BB is doing re-assigning it.

    However WP2BB hasn’t been updated in over 6 years, most likely it was created before $table_prefix was defined as a global.

    You might want to find another plugin that does the same thing but is supported on newer versions of WP.

    Plugin Contributor Greg Ross

    (@gregross)

    I’ve done a little more investigation, from the WordPress Codex (http://codex.ww.wp.xz.cn/Creating_Tables_with_Plugins):

    If you’re developing for a version of WordPress older than 2.0, you’ll need to use the $table_prefix global variable, which is deprecated in version 2.1.

    The next release of WP Statistics will remove $table_prefix and replace it with $wpdb->prefix in all instances.

    I don’t know if that will fix your problem or make it worse, but it will at least be correct 🙂

    Thread Starter felr

    (@felr)

    fantastic, thanks!

    By the way, if all software developers/companies would have response times as you do, the (IT) world be a better place. 😉 Thanks again!!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WP Statistics tables use wrong table name prefix’ is closed to new replies.