When user register in phpBB, can be added at same time into WP?
Posted: Tue Jan 16, 2018 6:21 pm
This is the original question via email received, which i would answer as hint for all here, and as suggestion for a trick that will be added on next versions.When a user signs up to the phpBB, is a wordpress user profile automatically
created for them?
The answer is No, but could also be Yes. Let explain.
No because this is a WP plugin, then the code run only on WP side. If an user register in phpBB, no code is execute in WP side, until user not load a WP page, and so will be added also into WP.
At same time, could be achieved with a snippet of php code, in many flavors, that can be executed by phpBB when user register. But you have to add this code into phpBB, that will provide to create the user in WP database also.
But the answer is also Yes (+- at same time) if you use a trick and this plugin:
1) a php code, that force redirecting the user to WP, when login is done phpBB (so if it has not still added into WP, will be added).
2) or a JS code applied into some template file (may overall_header.html, or overall_footer.html) that should do the same (redirect to WP the user after the login in phpBB).
In WP_w3all iframe mode, this concept is applied with the JS trick that you can see in action: if an user login in phpBB, the WP page reload because a JS code is executed to detect phpBB login/out state of user.
But is possible to do some more. Also without iframe. Via JS or Php.
A simple code in phpBB, let say maybe javascript, that redirect the user to WP when login is done, appending one or more vars: when the WP page will load detecting these vars, could add the user in WP on fly, because the plugin will found a valid phpBB cookie, so the user addition in WP will fire: due to detected vars, after user has been added, and before WP will go to output, could be so redirected from where he was coming from, so in phpBB.
This trick is more hard to explain in words than to be coded.
It is the same concept (that already work) for the registration/login done in phpBB via iframed WP page.
Will be added something about it (Js version) for the phpBB overall_footer.html code on next plugin versions.
And a simple snippet to redirect in same way, with same result, but using php, so will be possible to use one or other (php more reliable, because on this, will work in any case).
The plugin will add instead the simple php code, that will answer doing tasks (adding user and redirecting to forum) in the right way, when passed vars will be detected.