Disable registrations using Social Login - code not working

I would like to disable registrations using Social login and have copied the following code into my themes functions.php file http://docs.oneall.com/plugins/guide/social-login-wordpress/#3f However when I try to login with a user that is not registrered as a Wordpress user using social login the page is redirected to the following URL: https://hamar-tennis.no/wp-login.php?oa_social_login_source=login but instead I would like it to go to the default registration page for Wordpress: https://hamar-tennis.no/wp-login.php?action=register

Best Answer

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited November 2017 Answer ✓
    Hello,

    could you try changing the function like this?

    //Disable registrations using Social Login function oa_social_login_disable_registrations ($email) { if ( ! email_exists ($email)) { wp_redirect ('https://hamar-tennis.no/wp-login.php?action=register'); exit(); } return $email; } //This filter will be applied when new users are registering using social login add_filter('oa_social_login_filter_new_user_email', 'oa_social_login_disable_registrations');

Answers

  • Thank's for your reply Claude. Your code did not work like expected so did a little googling and found out that the wp_redirect function require a exit(); so after adding this code after wp_redirect ('https://hamar-tennis.no/wp-login.php?action=register'); it's now working! Thank you :-)
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited November 2017
    Sorry, completely forget about the exist! Thank you for the update, I've added it to my example.

    I'm glad to hear that it works now!
Sign In or Register to comment.