Title: [Plugin: WordPress Popular Posts] Data Reset after Update
Last modified: August 19, 2016

---

# [Plugin: WordPress Popular Posts] Data Reset after Update

 *  [topas](https://wordpress.org/support/users/topas/)
 * (@topas)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/)
 * I updated WordPress Popular Post but now all stats are reseted. I have two tables
   in my Database: wp_popularpostsdata and wp_popularpostsdata_backup but i don´
   t know how to get the old stats for my blog. All Blogentries now have 1 Pageview.

Viewing 15 replies - 31 through 45 (of 55 total)

[←](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/2/?output_format=md)
[1](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/?output_format=md)
[2](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/2/?output_format=md)
3 [4](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/4/?output_format=md)

 *  Thread Starter [topas](https://wordpress.org/support/users/topas/)
 * (@topas)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145942)
 * The table wb_wpptemp now exists in my Database.
 * I´m not a coder or somebody like this, but this line of your script:
    $wpdb->
   query(“CREATE TABLE wp_wpptemp ( UNIQUE KEY id (postid), postid int(10) NOT NULL,
   day datetime NOT NULL default ‘0000-00-00 00:00:00’, last_viewed datetime NOT
   NULL default ‘0000-00-00 00:00:00’, pageviews int(10) default 1 )”);
 * has been done.
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145944)
 * Hi topas,
 * Please go to phpmyadmin and run this query: SELECT DISTINCT postid FROM wp_popularpostsdata_backup
   ORDER BY postid
 * Let me know what are the results from that.
 *  Thread Starter [topas](https://wordpress.org/support/users/topas/)
 * (@topas)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145946)
 * Hey Ikki … i write out all entries (56 Pages á 30 Entries) and sum them up … 
   i make new entries in wp_popularpostsdata with this data and the number of pageviews
   of each postid. I have 91 postID´s (my Blog exists since may … a new blog) and
   i made it in the last hour. Now the Data is ready, correct and live.
 * Thank´s for your great support!!! I hope this was the last time, i make you crazy
   with my Problems. 😀
 * I´m happy that my Blog has only 56 Pages and not 500 … then your script will 
   be the best solution.
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145948)
 * That’s why I wrote that script xD Anyways, hope to get a feedback from someone
   else having this issue.
 * Cheers!
 *  Thread Starter [topas](https://wordpress.org/support/users/topas/)
 * (@topas)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145950)
 * Yes your script gave me the idea and the amount of data is small sized. 😀 So
   i do it manually.
 * Thank you again!
 *  [Gersprenz](https://wordpress.org/support/users/gersprenz/)
 * (@gersprenz)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145986)
 * Ok, so I have an old blog since 2004, more than schubbiduuh articles and run 
   into the same problem as described by topas.
    I didn’t have the right to execute
   the script, and yes i renamed it. Any hints how to modify your script?
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145992)
 * Well I’ve been doing some research about that permission issue topas mentioned
   and it seems to be a WordPress thing. Please try this (backup your data first!):
   [http://beconfused.com/2007/08/28/how-to-solve-you-do-not-have-sufficient-permissions-to-access-this-page-in-wordpress/](http://beconfused.com/2007/08/28/how-to-solve-you-do-not-have-sufficient-permissions-to-access-this-page-in-wordpress/)
 *  [jonmrich](https://wordpress.org/support/users/jonmrich/)
 * (@jonmrich)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145998)
 * I had the same problem and tried the script above. Everything worked as you said
   except that it had precisely the opposite effect. All of my data is now gone.
   It was showing some data before, but this script seemed to completely reset everything.
 * I looked at my database and see that this table wp_popularpostsdata is basically
   empty (i.e., only has from the time I upgraded the plugin). However, wp_popularpostsdata_backup
   seems to have all the historical data down to the minute I upgraded the plug 
   in. Is there a way to have the plug in call data form the backup and also current?
   Or to merge the two?
 * Thanks! I love this plugin and hope I can get it working again.
 * Best,
    JMR
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1145999)
 * Hi jonmrich,
 * The script attempts to import all data from wp_popularpostsdata_backup into wp_popularpostsdata.
   However, for some reason I have yet to discover it doesn’t work for some people.
 * I’ve updated the script, can you please test it for me? If so, please [**download it here**](http://www.2shared.com/file/7148956/8ee236dc/recovery.html)
   and place it into the wordpress-popular-posts directory. Then, log in into your
   wp-admin area, and type this URL into your address bar: [http://yoursite.com/wp-admin/options-general.php?page=wordpress-popular-posts/recovery.php](http://yoursite.com/wp-admin/options-general.php?page=wordpress-popular-posts/recovery.php)(
   please replace **yoursite.com** with your actual url!) to run the script.
 *  [jonmrich](https://wordpress.org/support/users/jonmrich/)
 * (@jonmrich)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1146004)
 * Thanks for getting back with me so quickly. The script ran perfectly fine and
   I got the “done!” message, but it didn’t have any effect. The all-time popular
   posts and pages appear only to be those since I reactivated the plugin after 
   running the script (i.e., only shows 5 page views total).
 * I’m assuming that it is still not pull from the back up. The script actually 
   seems to have the opposite effect from what’s intended. As an experiment, I ran
   the script again and reactivated the plug in. This time it showed “Sorry no data.”
   as if the script erased the data that was captured in the few minutes it was 
   active before I re-ran the script.
 * Any other thoughts you have would be appreciated.
 * Thanks again for your efforts.
 * Best,
    Jonathan
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1146005)
 * Hey, no problem!
 * Anyways, back on topic. This is what happens when the script is ran:
 * # Table wp_popularpostsdata is deleted
    # Then, a temporary table is created #
   Next, the script attempts to retrieve all data from wp_popularpostsdata_backup#
   If success, all the retrieved data is inserted into the temporary table that 
   was created earlier # Temporary table is renamed to wp_popularpostsdata, and 
   a “success” message is printed
 * Can you please re-run the script and then take a screenshot of the wp_popularpostsdata
   table in your phpmyadmin?
 *  [jonmrich](https://wordpress.org/support/users/jonmrich/)
 * (@jonmrich)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1146006)
 * Thanks again…
 * Re-ran the script and got a message of “done!” Couldn’t do a screenshot having
   trouble with access to my phpmyadmin, but I did a database back up and got this.
 * #
    # Data contents of table `wp_popularpostsdata` #
 * #
    # End of data contents of table `wp_popularpostsdata` # ——————————————————–
 * # ——————————————————–
    # Table: `wp_popularpostsdata_backup` # ——————————————————–
 * #
    # Delete any existing table `wp_popularpostsdata_backup` #
 * DROP TABLE IF EXISTS `wp_popularpostsdata_backup`;
 * #
    # Table structure of table `wp_popularpostsdata_backup` #
 * CREATE TABLE `wp_popularpostsdata_backup` (
    `postid` int(10) NOT NULL, `day`
   datetime NOT NULL default ‘0000-00-00 00:00:00’, `pageviews` int(10) default ‘
   1’, UNIQUE KEY `id` (`postid`,`day`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
 * #
    # Data contents of table `wp_popularpostsdata_backup` #
 * INSERT INTO `wp_popularpostsdata_backup` VALUES (131, ‘2009-01-18 00:00:00’, 
   1);
    INSERT INTO `wp_popularpostsdata_backup` VALUES (127, ‘2009-01-18 00:00:
   00’, 2); INSERT INTO `wp_popularpostsdata_backup` VALUES (83, ‘2009-01-18 00:
   00:00’, 1);
 * This table goes on for a while with all the popular posts data. It looks like
   the data from the backup wasn’t moved at all.
 * Let me know if you can make anything of this.
 * Thanks again.
 * JMR
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1146007)
 * Hey, sorry for not replying earlier. Busy weekend!
 * Anyways, please open recovery.php using a text editor such as Dreamweaver or 
   Windows’ Notepad and replace this line of code:
 * `$old_rows = $wpdb->get_results("SELECT DISTINCT postid FROM ".$wpdb->prefix."
   popularpostsdata_backup ORDER BY postid");`
 * …with this one:
 * `$old_rows = $wpdb->get_results("SELECT postid FROM ".$wpdb->prefix."popularpostsdata_backup
   GROUP BY postid ORDER BY postid");`
 * Then, run the script again. Let me know what happens.
 *  [jonmrich](https://wordpress.org/support/users/jonmrich/)
 * (@jonmrich)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1146008)
 * Thanks so much for the ongoing help. Unfortunately, this didn’t work. The script
   loaded fine, I got a message of “done!” but the plug in still serves up “Sorry.
   Not data so far.”
 * I can’t begin to know what’s wrong, but I don’t think the data from this table(
   wp_popularpostsdata_backup) is actually being moved. That’s where all the data
   is stored right now. It’s still there and I don’t see anything in the plug in
   or script that would indicate that it would try to move or call anything from
   there. Is that the issue or is the “wp_” part not essential?
 * Anyway…happy continue to have your help. I appreciate it. Just bought you a beer
   via PayPal. The least I can do to get one more minute from you.
 * Thanks,
    JMR
 *  [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * (@ikki24)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/3/#post-1146009)
 * Well, WordPress’ table prefix is automatically added with $wpdb->prefix, so that
   can’t be the problem. You’re right, though. For some reason it’s not accesing
   that table and therefore no exporting can be done. You might want to change …
 * `$old_rows = $wpdb->get_results("SELECT postid FROM ".$wpdb->prefix."popularpostsdata_backup
   GROUP BY postid ORDER BY postid");`
 * … into …
 * `$old_rows = $wpdb->get_results("SELECT postid FROM wp_popularpostsdata_backup
   GROUP BY postid ORDER BY postid");`
 * Also, please change:
 * `global $wp;`
 * …into:
 * `global $wp, $wpdb;`
 * … and run the script again.
 * And hey, thanks for the beer! I’d help you even without it, but thanks anyways!

Viewing 15 replies - 31 through 45 (of 55 total)

[←](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/2/?output_format=md)
[1](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/?output_format=md)
[2](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/2/?output_format=md)
3 [4](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/4/?output_format=md)

The topic ‘[Plugin: WordPress Popular Posts] Data Reset after Update’ is closed 
to new replies.

 * 55 replies
 * 9 participants
 * Last reply from: [Héctor Cabrera](https://wordpress.org/support/users/ikki24/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-data-reset-after-update/page/4/#post-1146134)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
