WordPress phpBB integration 2.4.0-dev

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Hi, thank for reply, in the while i resolved many more bugs, soon we'll be up and running for the next RC, that will be presumably the last pre release.
I will post in attach asap, hopefully this night my time, if possible.
I regret that on these days, i had to loose my time into something else, anyway and in any case, the 2.4.0 code will be finished in little time more.

No limit on any feature, but the WP admin ID1 and phpBB id2 are not linked anymore.
And the integration works linking users by email.
About the wp admin (any wp admin or user), may be careful to not link him with same email that may belong to main install admin, the user ID2 in phpBB, if it exist.

2.4.0 will provide several little docs, on how to speedup the integration for large traffic sites, reducing to the minimum code execution, that by default will works fine into any. These little docs, will become effective options, along 2.4.0> releases
Become compatible with any alphabet other than Latin, but by default provided only Cyrillic. If anybody will ask for something else, we can add it or easily indicate how to do.

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Received an interesting email, that focus into a problem with a question:
this plugin, allow to add as deactivated in phpBB, all users when they are added in phpBB due to a registration in WordPress, and when it is required that an user, like on memberpress, have to pay and/or confirm signup and then his account is activated to access contents?

The point is this: until 2.3.9 there is an option in plugin admin, that do this, add users in phpBB as deactivated, and should (should) activate the account only when active. But will work on any situation? Any plugin? Or you'll have to manually activate the user in phpBB (because until deactivated in phpBB will not be able to login in wordpress)?

And another important consideration:
should the user be added like it is now, on signup, so even if user's registration/signup not confirmed or not completed, because may it is a fake registration or being lost for some reason, then we'll have an user in phpBB, that will not allow after, to register another same username until it has not been removed in phpBB.

Based on this, is possible try to switch the actual code, to add user in phpBB, only when it has been activated/confirmed signup in wordpress, or memberpress etc.
If not too much complicate to be added for any scenario, then the code still will add the user in phpBB on signup, without waiting for confirmation, but the flow about to activate the user, will be fixed for all

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Tested the registration flow on buddypress and memberpress.
What happen is this:
with activated option add phpBB user in phpBB as deactivated, all works smooth, the user is activated when signup email confirmed, into a buddypress registration (where the user choose his pass, but the account still need to be activated in order to be able to login).

And maybe if mixed with memberpress, only after executed payment, the user should be able to see some forum.
If the user belong to a subscription, can see or use some board feature, etc etc
How to do this little hard, with easy?
We go to consider memberpress, like a separated thing. But how? So easy.

This is the way without going to change nothing on actual code, but resolving like this, as i did in the past:

May into a function inside an init hook (add into wp_w3all_php file, maybe, maybe elsewhere):

Code: Select all

....
$user = MeprUtils::get_currentuserinfo();
$active_products = $user->active_product_subscriptions('ids');
....
Note: can also use 'products' or 'transactions' as the argument type
we get an array, that allow us to do everything. This is the most reliable way, the faster and intelligent (to me) to do things, that do not overload the system, and that allow an immediate code execution, only when needed, just in time. Perfect.

if by ids, it is assumed you know each ids to what kind of subscriptions belong to, then choose what to do with the user, if can or not view forums, updating to activated in phpBB or not if the subscription expired or is not a lifetime membership etc.
Here example on how to activate or deactivate user, but could be needed to move the user to a group or another, based on active or expired subscriptions.

Then execute something like this (note that these instructions are ok on 2.4.0, $user->user_email need to be lowered before):

To Deactivate user in phpBB
$w3db_conn->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_type = '1' WHERE LOWER(user_email) = '".$user->user_email."'");
To Activate user in phpBB
$w3db_conn->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_type = '0' WHERE LOWER(user_email) = '".$user->user_email."'");
Or something else

Fast.
This part will be maybe documented, with ready to use code snippets

... may added as option using a different way, and adding actions via memberpress hooks.
There are really many possible integrations kinds.
Memberpress works nice. It is possible to create complex mixes with forums permissions, may based on different memberships, with easy.

But memberpress is not a free plugin.
I'm little not totally convinced to add this part as free plugin option on plugin admin.

So in the while, take the above hint as magic trick, to do what you want based on user's memberships/subscriptions ... it is an easy addition, that can be hooked into any wp event, also init (which is where i added into last integration site i configured).

Along 2.4.0> releases, buddypress/phpBB profile fields integration, will be re-coded, still not tested this part, assuming that should still work fine but not tested yet. It is anyway a little mess of the past, that works, but need to be re-coded. The avatar integration is fully working as is, even if on 2.4.0 something about as been little improved.

Stay tuned lovely and cool people, 2.4.0 is coming

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Hi there!
This is 2.4.0 RC2 that still do not fix all about transfers and user's check processes.
Fix several bugs.
Tested under many different scenarios, all working with no errors, all answering exactly as needed.
I can't find out any error at moment, anyway it is so hard to do not forget something, so any report would be appreciated.
Here we go!

RC3 has been released more below

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Hi there again!

Looking into fix all about transfer processes and check options, for the last coming RC3, i've find out, beside some hint explain error (i'm sorry), an easy solution for an important function, to detect if existent phpBB usernames, contains or not unwanted characters.
https://www.axew3.com/w3/forums/viewtop ... 4918#p4918
That's maybe an idiot consideration, maybe not. Let know what you think about the stupidity that maybe was obvious for advanced.

A though on how the thing on transfer/registered users from phpBB into WordPress works:
if an username in phpBB is in Latin, it is added in WordPress, purged of any unwanted character based on this regexp:
[^-0-9A-Za-z _.@] or to better say, as linked above will be [^-[:alnum:] _.@]
so an username like
a'l @ewdw/&%$£$£
will be added in WordPress as
al @ewdw
the username cleaned. If the resulting string is an empty string, so the username is not added and error message will display.

If the phpBB username is non Latin but Cyrillic, it is added only if it do not contain unwanted characters. If containing unwanted chars in Cyrillic, will not be cleaned up and nor added into WordPress.

If on WP MUMS, usernames characters regexp has been restricted to only:
[^0-9A-Za-z]

The integration, if phpBB is configured to not allow new registrations nor profile fields updates for email and url, can be set excluding the execution of the main query verify_phpbb_credentials(), speeding up the integration to maximum possible. No queries executed during normal users operations, but on singles when they update profiles in wordpress.

In true, due to simplicity of the code, if phpBB configured on ACP to do not allow users to update those fields on UCP
it would be just necessary to put a
return;
just after the

Code: Select all

private static function verify_phpbb_credentials(){
line, on /wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php
and just some little more code change into few functions.
An option will be added about this, somewhere along 2.4.0> releases or if possible even on this release

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

2.4.0 RC3
Transfer processes and check options, that can be used to start a smooth and easy to do integration, have been fixed.
It need to be mention something when phpBB users are transferred into wordpress: users that contains characters not allowed in wordpress, are added into wordpress with different username (cleaned of unwanted chars), or not added at all, if the resulting username after clean up is not possible to be processed, so:
a'l @ewdw/&%$£$£
will be added in WordPress as
al @ewdw
then if after, you go to check users executing (for example) the task List existent WordPress users that not exists in phpBB, and WordPress phpBB users with mismatching emails to check if there are users having different emails on phpBB and wp, it will return those users with mismatching username-emails (because usernames do not match). You'll get something like:
-> WARNING! username ALE-0 exist in WordPress but not in phpBB! // because it is $£ALE'-\=0 in phpBB
-> WARNING! username al @ewdw exist in WordPress but not in phpBB! // because it is a'l @ewdw/&%$£$£ in phpBB
Perfectly congruent. But if it is what you need, you so should not consider the notice that appear.
You know that the integration works by email now.
You may will worry to check if there are duplicated usernames or email in this case, that would be the only problem you'll have to resolve, and you can check it by using the related check option.
Those users with mismatching usernames, will have to login using email or the WP username when logging in via WordPress login, that's maybe stupid to mention/remember.

testing it, remember please:

Please, test it considering that users, it is mandatory that are allowed to change their email on profile, and Register ONLY on wordpress OR phpBB.
Disable possibility to update email for users in phpBB (or you have to do the contrary, allow in phpBB and not in wordpress, but this is the way that need after to consider more aspects). Also note that users ID1 in WP and ID2 in phpBB are not considered/linked anymore.

to disable users email update on phpBB:
ACP -> TAB System -> User Control Panel -> click into Profile -> Edit account settings, click into Disable to disable the user's account settings module. Then the Edit account settings , where it is possible to update user's email and password in phpBB ucp will not be accessible (while all the rest of phpBB profile options will be still available to phpBB users). Disable new registrations in phpBB.
since there is possibility that somebody will be wrong on correctly execute tasks, i think would be better to add a filter to avoid unwanted logic behaviors. The filter do just this: when an user or admin, go to update email or password, the code will fast check if the actual user's email (not the attempted new one) is shared in phpBB between different users, and will stop execution if duplicated email found. Or the profile update will happen for all phpBB users with same email. That should never happen (maybe, but maybe it could be what is needed instead). This will display in those cases
ERROR: actual email is paired with more than one username into our forum. The profile update has been rejected.

may this will work on native wordpress, and not into frontend plugins profile pages, like memberpress or others. It is not sure that all plugins hooks into native WP actions/filters. So also for this reason, it is important that users are allowed to update email (and register), ONLY in WordPress OR phpBB
not on both.

new RC3 2 more below

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Detected bugs:

1) The transfer process is not working fine when transferring users from wp to phpBB.
2) The phpBB ban function need to be fixed to work faster and more precise.
3) If an user is logged in phpBB with another username, and at same time as another in wp on different tabs, users follows as logged into both as different.

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Hello!
all assertions on prev post should be now covered

test following these rules:
https://www.axew3.com/w3/forums/viewtop ... 4933#p4933

The w3_phpBB ban function has been fixed, to be executed fully, and not skipped in certain cases
It has not been really optimized, anyway now, run just the strict necessary, once, and just in time when required.

The main verify_credentials query has been shorted and the ban check, if presenting session, will check only for an explicit ban due to email or username phpBB ban, not for IP. The complete ban check, is instead done when user login on WP. A message will display (on both cases) informing about ban. It could return exactly the reason of the ban, anyway at moment, like before, it return a generic ...username, email or ip are banned into our forum... message

let's go with
w3all-phpbb-integration 2.4.0 RC3 3
released more below

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Wrong 1 line addition, on last rc3 leads to a loop in the case usernames mismatch.
So when it should work fine for users with different usernames, it will lead to a loop.
RC3 3 is coming within today
also wp to phpBB transfer need to be fixed since adding users in phpBB not belonging to any users group

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Just changed three lines on class.wp.w3all-phpbb.php
leading to a loop when usernames mismatching.
The correct code look like this. Now all works smooth, when an user come into wordpress, and his wp email do not match the one presented by another possible phpBB session, due to a login in phpBB, may done into another browser's tab

Code: Select all

if( $current_user->user_email != mb_strtolower($phpbb_user_session[0]->user_email,'UTF-8') ){
    wp_destroy_current_session();
    wp_clear_auth_cookie();
    wp_set_current_user( 0 );
}
....
w3all-phpbb-integration 2.4.0 RC3 3


also adjust the user's transfer to phpBB, since was adding users into phpBB, belonging to no group at all, due to commented instructions for debug leaved in place, sorry!

To test and use 2.4.0, remember that you have to follow these rules: https://www.axew3.com/w3/forums/viewtop ... 4933#p4933

w3all-phpbb-integration 2.4.0 RC3 4
released more below on this topic

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Fixes for main verify_credentials, and more errors fixed all around, still there is something to adjust into a query about mchat.
The code has been shorted again, and all should be now quite ready

w3all-phpbb-integration 2.4.0 RC3 4

wp-w3all-wordpress-to-phpbb-install-and-how-to



Attachment removed: RC3_5 PRE RELEASE has been published here in reply!

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

Hey!
This is RC3_5 cleaned UP and now all fixed, except for a specific option that only affect mChat integration.

Ready to welcome 2.4.0!?

Php8> ready, WP5.6> ready
, Cyrillic usernames ready, and ready to be used into any other than Latin chars with easy and few changes.
Should fix all, and any front-end plugins logins and profiles custom pages profile updates flows, when they respect default WP hooks rules, and/but most of the times, even when not.

READ:
https://www.axew3.com/w3/wp-w3all-wordp ... nd-how-to/

and may this
phpBB WordPress 2.4.0 integration: 1001 ways, 1001 logs - how to

which will be increased with examples and explains

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

Re: WordPress phpBB integration 2.4.0-dev

Post by axew3 »

2.4.0 has been released.
It is time to prepare the new v6 iframe code for all the cool people.
Stay tuned!

Locked