[wp-hackers] User Capabilities

David House dmhouse at gmail.com
Thu Jul 14 11:06:50 GMT 2005


On 7/13/05, Ryan Boren <ryan at boren.nu> wrote:
> I think we might have some other issues during the migration.  Need to
> check.

There seem to be major problems when creating a user -- I get a
faceful of PHP warnings when creating a user (and thus I'm not
redirected back to users.php, because of the warnings).

I think this is because WP_User::get_role_caps() is called from the
WP_User constructor, but at this time, the user doesn't have any
roles. The code in users.php to create a user looks like this:

$user = new WP_User($user_ID);
$user->set_role(get_settings('default_role'));

Now, WP_User::get_role_caps() will be called from the first statement,
but it's not until the second statement that the user gets a role set.
The warnings were all warnings to do with variables not being arrays:
foreach() and array_merge() were complaining. I'm pretty sure it's
replicatable; just try to create a user through the admin interface.

-- 
-David House, dmhouse at gmail.com, http://xmouse.ithium.net


More information about the wp-hackers mailing list