Page 6 of 8

Re: WordPress phpBB integration 2.4.0-dev

Posted: Wed Nov 18, 2020 2:54 pm
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.

Re: WordPress phpBB integration 2.4.0-dev

Posted: Thu Nov 19, 2020 11:23 am
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

Re: WordPress phpBB integration 2.4.0-dev

Posted: Thu Nov 19, 2020 11:00 pm
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

Re: WordPress phpBB integration 2.4.0-dev

Posted: Fri Nov 20, 2020 5:54 pm
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

Re: WordPress phpBB integration 2.4.0-dev

Posted: Mon Nov 23, 2020 2:17 pm
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

Re: WordPress phpBB integration 2.4.0-dev

Posted: Mon Nov 30, 2020 10:20 am
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