Title: [Plugin: WordPress.com Stats] Error message after upgrade
Last modified: August 19, 2016

---

# [Plugin: WordPress.com Stats] Error message after upgrade

 *  [smallwebsolutions](https://wordpress.org/support/users/smallwebsolutions/)
 * (@smallwebsolutions)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-stats-error-message-after-upgrade/)
 * Just upgraded this plugin and received the following message:
 * Warning: Invalid argument supplied for foreach() in /home/xxx/public_html/wp-
   content/plugins/stats/stats.php on line 132
 * I had to deactivate the plugin by renaming the folder via ftp in order to access
   my admin panel, as this error made it inaccessible. I tried a fresh install (
   downloaded most recent version of Stats), but the same error occurred.
 * I now have it deactivated (renamed the folder via ftp).
 * Hopefully this information will help you fix the upgrade.
 * [http://wordpress.org/extend/plugins/stats/](http://wordpress.org/extend/plugins/stats/)

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

 *  [tengutech](https://wordpress.org/support/users/tengutech/)
 * (@tengutech)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-stats-error-message-after-upgrade/#post-1537585)
 * I just got a similar error when I upgraded.
 * Upgraded from **1.6.3** to **1.7.2**
 * WordPress ver: 2.9.2
 * **Error message:**
    Warning: Invalid argument supplied for foreach() in /home/
   <my directory structure removed>/wp-content/plugins/stats/stats.php on line 134
 * I get this error message in the header on each page of the admin section, and
   on the Dashboard in the _WordPress Development Blog_, _Other WordPress news_ 
   and _Plugins_ sections.
 * The _Stats_ widget header appears on the Dashboard, but nothing displays. And
   there is no _Site Stats_ menu item.
 * There doesn’t appear to be any errors on the site.
 *  [PoojanWagh](https://wordpress.org/support/users/poojanwagh/)
 * (@poojanwagh)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-stats-error-message-after-upgrade/#post-1537627)
 * I have the same problem:
 * Warning: Invalid argument supplied for foreach() in …/wp-content/plugins/stats/
   stats.php on line 134
 * I upgraded to WP 3.0 and to the latest version of the plugin in one swoop. Not
   sure which of these two steps cause the problem.
 * The offending line has:
 * `
    foreach ( $roles as $role ) { if ( current_user_can($role) ) { $cap = $role;
   break; } }
 * So, I don’t know if WP 3.0 doesn’t define `$roles = stats_get_option('roles');`
   any more.
 *  [evardsson](https://wordpress.org/support/users/evardsson/)
 * (@evardsson)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-stats-error-message-after-upgrade/#post-1537682)
 * I am getting the same error, but only on the sites that are updated via SVN and
   manual plugin upgrades. WP 3.0, Stats 1.7.2 (rolled back to 1.6.3 because it 
   still works)
 * Another site I manage is on a hosting provider and is a “one-click” WP install,
   using the single-click upgrade buttons etc. On that site WP 3.0 with Stats 1.7.2
   works just fine.
 * Still not sure what the difference is, unless it has something to do with the
   hosted site having more than one user and the others being one user only.

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

The topic ‘[Plugin: WordPress.com Stats] Error message after upgrade’ is closed 
to new replies.

## Tags

 * [Stats](https://wordpress.org/support/topic-tag/stats/)

 * 3 replies
 * 4 participants
 * Last reply from: [evardsson](https://wordpress.org/support/users/evardsson/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-stats-error-message-after-upgrade/#post-1537682)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
