Ok, this is the long story short:
when an user place an order in woocommerce and then go to create together with an user account, the
Code: Select all
private static function create_phpBB_user($wpu){
on
class.wp.w3all-phpbb.php fire:
the user is created in phpBB, but there is an autologin that occur in wp (or i have not find out an option that let me decide is users will auto login or nor, in case please let know if there is this option so i can test the solution also for this).
After this function end, the subsequent that will fire will be
Code: Select all
private static function verify_phpbb_credentials(){
here the problem come out, because the session of phpBB has not been released, may because woocommerce do not fire the default login wp hook, or it is may fired after
private static function verify_phpbb_credentials(){ that's on init. The phpBB cookie do not exist, the logout will happen.
To cut the head to the bull, to fix the issue, you should do this
open:
/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php
search for this code:
Code: Select all
$w3phpbb_conn->query("UPDATE ".$w3all_config["table_prefix"]."config SET config_value = '$wpul' WHERE config_name = 'newest_username'");
$w3phpbb_conn->query("UPDATE ".$w3all_config["table_prefix"]."config SET config_value = '$uid' WHERE config_name = 'newest_user_id'");
}
that's inside the function
private static function create_phpBB_user($wpu){
and just after the closing
}
and
before the very last closing
} function character,
so substantially JUST BEFORE the closing function character
}
add this:
Code: Select all
if(isset($_POST['woocommerce-process-checkout-nonce']) && isset($_POST['createaccount']) && $_POST['createaccount'] == 1 ){
if( ! defined("W3ALL_SESSION_ARELEASED") && ! defined("PHPBBAUTHCOOKIEREL") ){
$phpBB_user_session_set = self::phpBB_user_session_set($wpu);
define("W3ALL_SESSION_ARELEASED", true);
}
}
return;
Now all will work as expected. The code can be leaved in place, and be part of the plugin because with little changes, it will return to be useful for all others plugins that goes to autologins users in several ways after registration.
in attach if you do not want to edit yourself, this is the class.wp.w3all-phpbb.php ready with modification as above explained