[wp-hackers] User Capabilities

Jason Bainbridge jbainbridge at gmail.com
Wed Jul 13 19:07:06 GMT 2005


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.

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. :)

Cheers,
-- 
Jason Bainbridge
http://kde.org - webmaster at kde.org
Personal Site - http://jasonbainbridge.com


More information about the wp-hackers mailing list