I have a live WordPress installation and a local one for development purposes. I just exported the live database, replaced all occurences of the live siteurl with the local one, and imported on my dev machine.

Problem is that on my dev machine all users have lost any permissions. When logging in I get:

Notice: Undefined offset: 2 in /var/www/mysite/wp-admin/includes/plugin.php on line 1390 

On a page template I dumped out the current userinfo with

global $current_user;
var_dump( get_currentuserinfo() );

This returns NULL on my dev machine and the correct userinfo on my live installation. I double checked the table prefixes, permissions, tried a clean WordPress installation, etc but had no luck. The confusing thing about this is, that I can query the userinfo perfectly fine with a custom sql query.

EDIT: Upon further inspection I found out that the global $wp_roles contains no user roles and capabilities. WordPress somehow can't retrieve this from the database...

EDIT 2: Sorry for the edits. But I found the problem. Inside the wp_options table there is a row "wp_user_roles". The value, an unserialized string did somehow include whitespaces which lead to errors when trying to unserialize the string. I replaced the database value with the live site's one and everything works now.

没有正确的解决方案

许可以下: CC-BY-SA归因
scroll top