Make WordPress Core

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


Ignore:
Timestamp:
02/23/2011 09:54:39 PM (14 years ago)
Author:
jrfoell
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16617, comment 7

    initial v1  
    1 I see your point... short of convincing the team to change to a singleton or a static method, I will use your recommended method.
     1Ignore the static patch to get_role... that is not a good solution because you can't prevent the constructor of WP_Roles from being public in PHP4.  However, having WP_Roles' $roles property use the same reference as $wp_user_roles will work.
    22
    3 Maybe a static method would be considered for the WP_Roles? WP_Roles::get_roles( $role ) could be changed to instantiate itself if need be (essentially what get_role does now).  I attached a patch that shows how it could work... but it does little in the way of improvement because the get_roles() function needs to remain for backwards-compatibility.  At least encouraging people to use WP_Roles::get_roles would make it obvious that the code is in the WordPress namespace.  You may otherwise close this ticket.
     3I have attached a change that will allow both methods to work as normal.