Make WordPress Core

Ticket #16617: get_role_diff.patch

File get_role_diff.patch, 1.1 KB (added by jrfoell, 14 years ago)

Static WP_Roles::get_role() patch

  • wp-includes/capabilities.php

     
    204204         *
    205205         * @since 2.0.0
    206206         * @access public
     207         * @static
    207208         *
    208209         * @param string $role Role name.
    209210         * @return object|null Null, if role does not exist. WP_Role object, if found.
    210211         */
    211212        function &get_role( $role ) {
    212                 if ( isset( $this->role_objects[$role] ) )
    213                         return $this->role_objects[$role];
     213                global $wp_roles;
     214
     215                if ( ! isset( $wp_roles ) )
     216                        $wp_roles = new WP_Roles();
     217
     218                if ( isset( $wp_roles->role_objects[$role] ) )
     219                        return $wp_roles->role_objects[$role];
    214220                else
    215221                        return null;
    216222        }
     
    11141120 *
    11151121 * @see WP_Roles::get_role() Uses method to retrieve role object.
    11161122 * @since 2.0.0
     1123 * @depricated
    11171124 *
    11181125 * @param string $role Role name.
    11191126 * @return object
    11201127 */
    11211128function get_role( $role ) {
    1122         global $wp_roles;
    1123 
    1124         if ( ! isset( $wp_roles ) )
    1125                 $wp_roles = new WP_Roles();
    1126 
    1127         return $wp_roles->get_role( $role );
     1129        return WP_Roles::get_role( $role );
    11281130}
    11291131
    11301132/**