Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #16617, comment 5


Ignore:
Timestamp:
02/23/2011 11:51:01 AM (14 years ago)
Author:
solarissmoke
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16617, comment 5

    initial v1  
    11Here's the problem:
    22
    3 The function `get_role()` uses the global `$wp_roles`, which is instantiated the first time that `get_role()` is called. At instantiation, it loads the `wp_user_roles` option and stores it as `$wp_roles->roles`.
     3The 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`.
    44
    55Now, 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.