Changes between Initial Version and Version 1 of Ticket #16617, comment 5
- Timestamp:
- 02/23/2011 11:51:01 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16617, comment 5
initial v1 1 1 Here's the problem: 2 2 3 The function `get_role()` uses the global `$wp_roles`, which is instantiated the first time that `get_role()` iscalled. At instantiation, it loads the `wp_user_roles` option and stores it as `$wp_roles->roles`.3 The function `get_role()` uses the global `$wp_roles`, which is instantiated the first time that one of the capability functions are called. At instantiation, it loads the `wp_user_roles` option and stores it as `$wp_roles->roles`. 4 4 5 5 Now, whenever you use $wp_roles::add_cap() (as the procedural plugin does), it simply adds the capability to `$wp_roles->roles`, and then does `update_option()` to store it in the database. If, in the mean time, something else has updated the `wp_user_roles` option independently (which is what the OO plugin does, with it's own instatiation of the WP_roles class), then $wp_roles has no knowledge of this and simply overwrites those changes. Hence the capability added by the OO plugin is overwritten.