• Resolved ulver85

    (@ulver85)


    Hi, I have about 20000 users already registered on my website and I want to mark them as verified, how I can do it ?

    I can’t use bulk action because they are so many.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author PickPlugins

    (@pickplugins)

    Thanks for your post.

    I don’t see other way except bulk approve.
    I should add this feature to automatically update existing user to marked as approved.

    Regards

    Thread Starter ulver85

    (@ulver85)

    Hi, I wrote a plugin to do that on my own, yes, I think that you should add this feature… it’s impossible to use the WP bulk action for thousands users.

    This is the code:

    if ( current_user_can( 'manage_options' ) ){
                // you can use role => Customer for woocommerce
                $wp_user_query = new WP_User_Query(array('role' => 'Subscriber', 'number' => $number, 'offset' => $offset));
    
                // Get the results
                $users = $wp_user_query->get_results();
    
                // Check for results
                if (!empty($users)) {
                    foreach ($users as $user)
                    {
                        // set the activation status on approved
                        update_user_meta( $user->id, 'user_activation_status', '1' );
                    }
                }
            }

    You need to handle the $number and $offset variables to avoid server timeout, maybe you can use multiple ajax call to split the job in multiple jobs.

    Another way is to handle this process through an SQL query.

    Bye

    • This reply was modified 6 years, 11 months ago by ulver85.
    Plugin Author PickPlugins

    (@pickplugins)

    Thanks for your code, i will try to add in next plugin release.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Approve all existing users’ is closed to new replies.