Hi everyone! Today We’ll discuss VanillaForums integration plugin with WordPress. And I’ll explain solutions for problems we were facing integrating WordPress with VanillaForums. The result as improved plugin you can download from here.
Out of the box it provides us VanillaForums powered comments for posts, and cool Single Sign On (SSO) feature which means your users can login on your wordpress website and whenever they go to your community provided by VanillaForums they will be logged in there with a same account.
For example we’ve used this SSO feature for one project where we’ve set up vanilla community to register only through SSO, so our users will be registered on our main WordPress based website first and then this account information used for vanilla accounts on a community.
All was fine except logic of creation of users on vanilla’s side.
You might expect that whenever you create user on you main website it automatically creates one on a community, but not. Imagine you need a link or button on a main website to point to community and in order to have your SSO working you need to point your users to a link of such format:
What it does? when your logged in user call’s this link vanilla calls your wordpress website weather this user exists, if yes it sign’s on a user if not it offers to sign in on a community’s website which will redirect to your wordpress login\register page which you’ve specified in vanilla’s settings.
Also you need to know that whenever you user call’s this URL it doesn’t just signs on if user exists it also synchronize’s user data, and if a user with provided email doesn’t exist it automatically creates one for you in vanilla.
So all seems ok – you just need to force your new users access your community via this link only and they will never know that account for them on a community was created only on their first visit of a community.
But in real life there are other cases too. For example you’ve created account for your friend and credentials were sent to his email and imagine he knows your community’s website URL and he just opens it and tries to login with these credentials on a community and this is where you come into trouble because there’s no such user on a community yet. Remember – it’ll be created as soon as a user logs in through SSO URL previously signed on on your main website.
So you need a way to automatically create users on a vanilla just as they are created on your main website, and also if needed manually force user data sync if any issues with it.
This is what I’ve achieved extending official wordpress-vanilla forums integration plugin.
You can download it from GitHub https://github.com/MikhailRoot/wordpress-vanilla
So currently after installing my version of this plugin you’ll have new option in it’s SSO settings.
So you can enable or disable Automatic creation of users on vanilla as they are registered on your main website.
Also you’ll have new option in bulk actions menu for Users in WordPress:
So whenever you’ll need to sync data like username, display name or Roles\Groups for any user you need just check them on Users list and Apply to them this “Update VanillaForum users data” bulk action.