Wordpress>Buddypress>Discourse Facebook signin plugin question


(Christopher Tate) #1

I’m running WP with the Buddypress plugin, and Discourse using SSO. Currently it requires two email activation’s to be fully regged on the site/forum. I’d like to make it a little easier, because I’m concerned it’s too much of a hurdle for new users, as we are just getting started, and you know how hard it is to start a forum. Fortunately, we have a Facebook group with about 70,000 people that we are trying to steer into the new site.

If I could get some advice on which FB plugin is suggested, and how I might be able to daisy chain the verification process through WP and Discourse, I would be forever in your debt.
Thanks in advance.


(Simon Cossar) #2

It’s requiring two email activations (one for the site, one for the forum) because the plugin isn’t able to verify the user’s email address. It is only able to to verify the user’s email if the default WordPress user activation process is being used. A lot of different plugins override the user activation process. How are users registering on your site?

Any plugin that has an action that you can hook into after the user is authenticated will work. If you find something that will do that with FB, I’d like to know about it.


(Christopher Tate) #3

Clicking the login or signup buttons on either site is redirected to the default WP login/signup page. If signing up, the user is sent an email by WP to verify the address. When the newly verified member visits the forum, they are sent a second verification email from the Discourse system, as per the SSO plugin. My focus has been on security thus far. Not being very familiar with either software package, I thought it best to start out with tight security and see how it went. It went as a very slow adoption rate. We’re pretty sure it’s complicated signup process we’re using.

Honestly, none of the Facebook login plugin look that great, from what I’ve seen. So, that has me concerned. I used the Facebook login for this forum, and it worked like a charm. I’d like to have the WP software be that easy, with no emails, since FB does a good job verifying email, and have WP hand the Discourse software that verification, with no emails.


(Simon Cossar) #4

Yes, I’ve been looking as well. I haven’t seen any that are being kept up to date. I’ll look into it some more, but possibly that would be a good WordPress plugin to create.

With the default login, the user shouldn’t be being asked to verify their email a second time when they visit the forum. I can look at that for you if it’s something you’d like to fix.


(Christopher Tate) #5

Well, the first email is sent by the parent site, running wordpress. When the member visits the second site, the Discourse forum, for the first time they get the second email. If that’s not suppose to happen, then any help to get the second email to stop would be great. I’ve got the FB login plugin working on the WP site, so if it can use that verification for Discourse, I think that’s pretty much what I’m looking for. There would be no emails at all. However I can facilitate your help, just let me know. And thank you very much.


(Simon Cossar) #6

I’m getting back to work on the wp-discourse plugin tomorrow, so I’ll look at this then.

What version of WordPress is your site using?
Which Facebook login plugin are you using?


(Christopher Tate) #7

WordPress 4.7.1
Facebook Login Version 1.1.6 By Damian Logghe
I appreciate your help, Simon.


(Simon Cossar) #8

I’ve tested the SSO registration process and I’m finding that it works as expected. When a user first registers on the WordPress site they are sent an email with their username and password information. The wp-discourse plugin is overriding the WordPress function that creates that email in order to add a ‘mail_key’ parameter to the query string in the activation link. That mail key is used to verify the user’s email and allow them to log into Discourse without having to reverify their email address.

My guess is that on your site another plugin is overriding the WordPress new user notification email function so that the mail_key parameter is not being included in the activation link. Can I try registering for your site so that I can see the registration email that’s being sent out?


(Simon Cossar) #9

The Facebook Login plugin Facebook Login — WordPress Plugins can tie in with wp-discourse quite easily. It has an action that can be hooked into after a new user notification is sent out that looks like it should be safe to use.

Adding this to the functions.php file works, but it should really be tested some more:

add_action( 'fbl/notify_new_registration', 'my_namespace_validate_email' );
function my_namespace_validate_email( $user_id ) {
	update_user_meta( $user_id, 'discourse_email_not_verified', false );
}

(Christopher Tate) #10

Sure, thanks for the info.
https://psychedelicphilosopher.com


(Simon Cossar) #11

I went through the registration process and the plugin is behaving as it should. Whatever is creating your front end login form is overriding the WordPress activation email function, so the wp-discourse plugin isn’t able to verify the email address.

The login form on your site seems good - it wouldn’t let me log into the site until I activated my account by clicking on the link in the activation email. It probably wouldn’t be difficult to hook into the registration process after the account is activated and remove the discourse_email_not_verified flag for the user. It would require some code similar to what I gave above for Facebook.


(Christopher Tate) #12

Thanks for the update, I really appreciate your help with this.
I’m wondering what I should do from here. If it’s a WP plugin that’s conflicting with the WP Discourse registration process, should I troubleshoot by deactivating the various plugins until I find the culprit? Or would you suggest adding the code you’ve provided to the functions.php file? If the latter, will it be obvious where I should put the code when I go to add it? I’m not great with the coding part of this process.


(Simon Cossar) #13

If you can figure out which plugin is creating the login form and it’s a free plugin, I’ll take a look at it.


(Christopher Tate) #14

It looks like Buddypress was controlling the registration page. I deactivated all the plugins, besides WP Discourse, and it worked correctly. It sent one email at WP registration which I used to activate my account, and logged right into Discourse on first visit when clicking on log in with no email activation.

However, when I turned the facebook plugin back on, it registered at WP with no email, but attempting to log into Discourse sent an activation email. That’s with only WP Discourse and Facebook login plugins active.

I’m not sure what troubleshooting steps to take from here.

Update: I added the code you’ve provided to the end on the functions.php page, and it’s works properly.
Update #2: Buddypress is now working, and it was actually a MainWP management plugin that was controlling the registration page.

Thanks so much for your help. I would literally not have been able to solve this without your help. I am indeed forever in your debt, sir.