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

Jon Cave jon at lionsgoroar.co.uk
Mon May 16 14:48:59 UTC 2011


On Mon, May 16, 2011 at 3:43 PM, Michael Winkler
<michi.mtrv at googlemail.com> wrote:
> 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?

Removing PHP4 constructors as part of the update in requirements.

See http://core.trac.wordpress.org/changeset/17604 and
http://core.trac.wordpress.org/ticket/16768

I will update the ticket later if you don't do it before me.


More information about the wp-testers mailing list