2.8.8 template integration improvements and 2.8.8 pre-logs

User avatar
axew3
w3all User
w3all User
Posts: 2866
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 »

Reasoning after into this problem, result clear that if a plugin let to choose the password, how it can be restricted the access of the user?
Where ultimate member have the setting that require to activate the account?
I cannot find it. So i cannot imagine how it could be managed the fact that an user when register since he know the pass.
Is there a setting i do not see into UM that require the user's activation?

p.s Found the setting that send the email, but not the one that set user's account email confirmation required... how it should be activated?

[EDITED]
User avatar
Ezrael
User www
User www
Posts: 95
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 »

Ultimate Member / User ROLES / Subscriber / Registration Options
User avatar
axew3
w3all User
w3all User
Posts: 2866
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 »

So i have again put eyes into the complete flow of things when there is activation involved and front end plugins leave to choose the pass.
If a front end plugin, leave to choose the password on the registration form, and have a specific way (it is for each plugin different as easily arguable) to check the activation it is hard to cover all.

The code as is is perfect as more it is possible (but as you can see it is very hard for anybody, even me, to remember all possible implications when after some time you think on why you coded like it is).

except the first suggested line, that obviously need to be

Code: Select all

if( current_user_can('create_users') === true OR $action == 'add_u_phpbb_after_login' ){ // an admin adding user
in effect for what it concern the UM plugin all works as expected, the code is already there, if you choose to add users in phpBB ONLY after their first login in WP set to Yes and Activate user after login set to No:

Until the user is not confirmed, his login fail into WP and it is NOT added into phpBB. So cannot login anywhere.
It is exactly the expected result. But it is because UM has been considered with this code into the function wp_check_password

Code: Select all

///////////
// check that this user do not need to be added into phpBB, due to $w3all_add_into_phpBB_after_confirm

       if( $w3all_add_into_phpBB_after_confirm == 1 )
       {

      // this is for Ultimate Member plugin, but the logic can be the same for any other plugin
       if(defined( 'um_plugin' )){
          $umeta = get_user_meta($wpu->ID);
         if( isset($umeta['account_status'][0]) && $umeta['account_status'][0] != 'approved' ){
           return apply_filters( 'check_password', false, $password, $hash, $user_id );
          }
        }
Maybe hints on plugin options should be better explained about this aspect, so to make it easy to understand what you have to do and why.

Anyway, resuming, in the case of front-end plugins that leave to choose the pass in WP on registration, except UM that have been considered on code by quite long time as example, but i will not do the same for each other, because as said each will use different flows, and even all can be fixed inside the function wp_check_password easily, i will not do if not on request for specific cases and not for free, would be better to NOT let to login users in phpBB in those cases.

Let say that UM have a strange behavior reversing his flow: at the time the user is added, the user result to be active, and only after several other hooks, do not know how much more, his code flow set the user as waiting for email confirmation, not before, before result to be active, but it is too late to detect that it is after changed if not creating another hook that could be, again very easily, detect if the UM user is active or not (or any other plugin flow), when all the UM code has been executed, and setting the user as active or not in phpBB based on this.

[EDITED 2 times]
User avatar
Ezrael
User www
User www
Posts: 95
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 »

I tested all ways of registration on my page. I have different possibilities because user getting different WP groups depending which registration they use.

If I were you, I would simply add a new note to your installation manual at

Add users in phpBB only after first successful login in WordPress

Note: if the option below
is set to Yes, then the user won't be added into phpBB before first login (using the activation link or got confirmed by the admin)
(This option should be set to Yes if you just use the WP-Registration for your Website)
User avatar
axew3
w3all User
w3all User
Posts: 2866
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! Thank you for the precise suggestion and the opportunity to fix a misunderstanding and another bug!

Code: Select all

if( current_user_can('create_users') === true OR $action == 'add_u_phpbb_after_login' ){ // an admin adding user
Post Reply