[wp-testers] Call to undefined method WP_Roles::WP_Roles()

Michael Winkler michi.mtrv at googlemail.com
Mon May 16 14:43:43 UTC 2011


Hi,

I use in my plugins the following code to show a list of user roles:

<?php
global $wp_roles;
$wp_roles->WP_Roles();
foreach ($wp_roles->role_names as $roledex => $rolename) {
        $role = $wp_roles->get_role($roledex);
        $select = $role->has_cap('use_teachpress') ? 
'selected="selected"' : '';
        echo '<option value="'.$roledex.'" 
'.$select.'>'.$rolename.'</option>';
}
?>

The same code works with WordPress 2.8 to 3.1.2 but not in the current 
nightly build (WordPress 3.2-beta1-17916). In WP 3.2 I see only only the 
following error message:
"Fatal error: Call to undefined method WP_Roles::WP_Roles() in [...]"

Is it a bug or was it a planned change in the WP_Roles class?

Kind regards,
Michael


More information about the wp-testers mailing list