2.8.8 template integration improvements and 2.8.8 pre-logs

User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: 2.8.8 template integration improvements and 2.8.8 pre-logs

Post by axew3 »

Good morning!
Let test and return back.

Anyway often, there are possibilities that are not immediately obvious, like to add users as a specified group into phpBB when they register into WP.
Same for phpBB when users are added into WP because they register into phpBB.
Beside this, going to test this aspect right now...
User avatar
Ezrael
w3 User
w3 User
Posts: 102
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: 2.8.8 template integration improvements and 2.8.8 pre-logs

Post by Ezrael »

Note: That's the situation for me but I don't use the phpbb registration anymore. The only way to register on my website is the WP registration even if you press on register in the phpbb.

I found this issue because some bots started to register. Luckily I recognised it directly.
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: 2.8.8 template integration improvements and 2.8.8 pre-logs

Post by axew3 »

Ok reproduced. It is just like you say, it simply do not work. The user is added as active into phpBB.
Fixing...
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: 2.8.8 template integration improvements and 2.8.8 pre-logs

Post by axew3 »

Ok
file /class.wp.w3all-phpbb.php
It is very strange that this line appear to be like this:

Code: Select all

if( current_user_can('create_users') === true OR $action = 'add_u_phpbb_after_login' ){ // an admin adding user
it is wrong because OR $action = 'add_u_phpbb_after_login' always return true, so the condition set by the way to 0 the value (user active).
it is clear that it need to be changed into this instead:

Code: Select all

if( current_user_can('create_users') === true OR $action == 'add_u_phpbb_after_login' ){ // an admin adding user
testing flow...
but i assume it will be changed into

Code: Select all

 if( current_user_can('create_users') === true ){ // an admin adding user
after more changes/additions on code so to satisfy all options requirements

[EDITED]
User avatar
Ezrael
w3 User
w3 User
Posts: 102
Joined: Wed Nov 15, 2023 9:11 pm
Contact:

Re: 2.8.8 template integration improvements and 2.8.8 pre-logs

Post by Ezrael »

Whats the normal behaviour, if someone register in wp and hasn't used the activation link?

The situation I now looks okay for me because als long as the user hasn't logged in to Wordpress your plugin doesn't add the user to phpbb.

After the first login the users gets transferred and activated in phpbb
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: 2.8.8 template integration improvements and 2.8.8 pre-logs

Post by axew3 »

Fixed.
Substantially the fix change this code:

Code: Select all

      // check that the user need to be added as activated or not into phpBB

        if( current_user_can('create_users') === true OR $action = 'add_u_phpbb_after_login' ){ // an admin adding user
          $phpbb_user_type = 0;
        } else {
          $phpbb_user_type = $w3all_phpbb_user_deactivated_yn;
        }
into this instead (or something like this):

Code: Select all

      // check that the user need to be added as activated or not into phpBB

        $phpbb_user_type = 0;
        
        if( current_user_can('create_users') === true ){ // an admin adding user
          $phpbb_user_type = 0;
        } elseif( ! current_user_can('create_users') && $w3all_phpbb_user_deactivated_yn == 1 ) {
        	$phpbb_user_type = 1;
        }
        
        if( ! current_user_can('create_users') && $action == 'add_u_phpbb_after_login' ){
          return;
        }
on file /class.wp.w3all-phpbb.php
inside the function
private static function create_phpBB_user($wpu, $action = ''){
this should fix all... let continue tests
Post Reply