• When i look at my lis of users, is see that I have a large number unapprove. When I click on unapporve, it says No Users Found, but i know i have many.

    Any help with how to see them would be great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • +1.

    The /wp-admin/users.php?role=wpau_unapproved page where all the unapproved users should be listed, is empty even though the user count says there are unapproved users. I can confirm that there are, in fact, unapproved users. I’ve tested unapproving some of them and the count increases but the list still says no users found.

    From the URL you can tell that it’s trying to filter the users table by the role wpau_unapproved. However, when I check the metadata of the unapproved user, the wp_capabilities meta does not contain the wpau_unapproved role, only the subscriber role.

    Since the role is not being assigned to unapproved users, they are not being displayed on the Unapproved users list.

    The wp-approve-user meta is present for the user, with an empty value. I understand that the unapproved users count comes from this meta and this is the one storing the approval status.

    Therefore, we need a fix for either correctly assigning the role or a different way to display the unapproved users based on the wp-approve-user meta instead of the wpau_unapproved role.

    WordPress and plugins up to date. Using the plugin User Role Editor as well. PHP 8.1.

    The plugin used to work, so something must have changed.

    The plugin uses the pre_user_query action hook on line 231 of the file class-obenland-wp-approve-user.php

    There is something going on in there that makes the unapproved users listing page to not work, and it even looks like it has to deal with some issues causing an infinite loop and the page not loading at all.

    I have fixed it by adding this code to my site:

    public function fix_wpau_filter( WP_User_Query $query ) {

    if ( ! is_admin() ) {
    return;
    }

    global $pagenow;

    if ( $pagenow !== 'users.php' || ! isset( $_GET['role'] ) || $_GET['role'] !== 'wpau_unapproved' ) {
    return;
    }

    $query->set( 'role', '' );
    $query->set( 'meta_query', array(
    array(
    'key' => 'wp-approve-user',
    'value' => false
    )
    ) );
    }
    add_action( 'pre_get_users', 'fix_wpau_filter', 10, 1 );

    With this, I can remove the plugin’s function code and the unapproved users page displays all unapproved users properly. The plugins function can be removed, but it will also work without removing it. This means that the developer should drop the use of the pre_user_query and use pre_get_users instead. He can make an adaptation of the code I’ve provided.

    If you are someone experiencing this issue, just add the code I’ve provided to your functions.php, you don’t need to do anything else.

    I hope the author of the plugin can fix this soon so that we don’t require this fix anymore.

    Plugin Author Konstantin Obenland

    (@obenland)

    I’ve not been able to reproduce this on a fresh installation of latest WordPress on PHP 8.1.

    @gerardreches When did this behavior change? Have you tried troubleshooting with other plugins disabled?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.