[wp-hackers] User Capabilities

Michael D Adams mikea at turbonet.com
Wed Jul 13 18:00:56 GMT 2005


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.

How far up should $wp_roles go?  Putting it straight after the  
capabilities.php include doesn't *seem* to break anything, and there  
are no hooks used before that point.

--Michael



More information about the wp-hackers mailing list