Disable User Registration

Hello,

I'm on WP, and I would like to disable user registration. I just want existing users to be able to link their user account to their social accounts, but I do not want people to be able to register - I have a private blog.

Cheers

Answers

  • Hi,
    You can add a filter that, when processing user login, will check if his email is already in the database and allow him to login only if this is the case.
    Add this code to the functions.php file of your WordPress templates (accessible via the dashboard -> appearance -> editor, select theme's functions).
    function oa_filter_email ( $email )
    {
       if (!email_exists($email))
       {
          wp_redirect ('http://url_to_registration_page');
          exit;
       }
       return $email;  
    }
    add_filter( 'oa_social_login_filter_new_user_email',  'oa_filter_email');
    
    Where the url_to_registration_page is the url where the registration takes place.

    Hope this helps.

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.