Wordpress Plugin Error when New User Registration is disabled

I am looking for a more elegant way to handle informing a user who tries to authenticate in using a provider when their email address does not match up with their user account that has already been created.

example.

a user is setup with their corporate email address in Wordpress, and they routinely connect using Widows Live or Google or Github, where their emails on those account match with the account in Wordpress.

then they decide to log in using their amazon account, which has their personal email address associated with it.

We do not allow people to self register on the site, so we have new user registration disabled.

Currently the code provided by oneAll, does the following: and displays an error that makes the site look broken

//Disable registrations using Social Login
function oa_social_login_disable_registrations ($email)
{
  if ( ! email_exists ($email))
  {
    trigger_error ('Registrations using Social Login have been disabled', E_USER_ERROR);
  }
  return $email;  
}

I am looking for suggestions to handle this more elegantly.

Answers

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited March 2018

    Hello,

    I think the easiest solution would be to:

    1) Create a new page explaining that registration is disabled.
    https://codex.wordpress.org/Pages

    2) Write down the public link to this page.

    3) Then you replace this:
    trigger_error ('Registrations using Social Login have been disabled', E_USER_ERROR);

    By this (replace $url by the link to the page):
    wp_redirect( $url ); exit;

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.