[wp-hackers] User Capabilities

Ryan Boren ryan at boren.nu
Wed Jul 13 19:31:42 GMT 2005


On Wed, 2005-07-13 at 14:07 -0500, Jason Bainbridge wrote:
> On 7/13/05, Michael D Adams <mikea at turbonet.com> wrote:
> > On Jul 12, 2005, at 8:55 AM, Ryan Boren wrote:
> > > Let the quibbling begin.
> > 
> > Currently $wp_roles is set essentially at the end of wp-
> > settings.php.  This can cause problems for plugins using hooks that
> > have already been called by that point:
> > 
> > 'option_*' filters
> > 'core_files_loaded' action
> > anything in wp_cache_postload()
> > 'plugins_loaded' action
> > 'template' filter
> > 'theme_root' filter
> > 'template_directory' filter
> > 'locale' filter
> > (and anything in my-hacks.php)
> > 
> > And any others I missed (I just gave things a quick glance).
> > 
> > For example, Ryan's Preview Theme plugin calls get_currentuserinfo()
> > during the 'template' filter, and get_currentuserinfo() needs global
> > $wp_roles around when creating the new $current_user object.
> 
> Ah so that was what was happening on my site! I have Ryan's Preview
> Theme plugin enabled, which was causing $wp_roles to not get populated
> due to the above so I moved the setting of $wp_roles to the suggested
> location and now everything is working fine.

http://trac.wordpress.org/changeset/2706

I rearranged the load order a bit.  That should patch things over for
now.

> Although somewhere along the line I had lost user_level from wp_users
> so I had to add that back in to get wp_capabilities set in wp_usermeta
> by the upgrader before I got to the stage of discovvering the
> $wp_roles problem, living on the bleeding edge is fun. :)

user_level has been purposely moved from users to usermeta.  However, I
think we're deleting user_level from users first and then later trying
to use it when setting up the roles and migrating to usermeta.  We need
to look into that.

Ryan



More information about the wp-hackers mailing list