Open register form if user attempts login with a not registered account


I am a developer and I’m using the “Ultimate Facebook plugin” in my BuddyPress site, and I want to allow users to log in and register within this site. However, when a potential new user tries to access the registration form (no longer been previously logged into facebook) an error message appears. I’d want avoid this error message, doing as follows: just puting the “Login with Facebook” button on the main page.

If a user tries to enter without having an existing account (ie, a new user) will be redirected to the registration form, because as tried to log in, means that already logged in Facebook (through the form that is opened). Thus there is no way any new user access the registration form without being logged into Facebook.

However, if the user has already a valid account on my BuddyPress site, the registration form will not be shown, jumping the navigation directly to the homepage of the site. I wonder if it is possible to implement this on my site, and how can I change the settings of plugin or even a few lines of code to accomplish this.

I managed to do it partially, using the “redirect on login” to page “register”, and when a user without a registered account on my site tries to login using facebook credentials, is correctly redirected to the registration page, which already was filled correctly. However, this will happen forever, even if the user already has an account on my site (in this case he is redirected to the main page of my website).

Thanks and best regards.

Yuri Bernardo