add_action('init', function() {
$limit = 140;
$count_users = count_users();
$total_users = $count_users['total_users'];
if($total_users > $limit) {
update_option('users_can_register', false);
} else {
update_option('users_can_register', true);
}
});