phpBB logon not logging into Simple Membership paywall

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: phpBB logon not logging into Simple Membership paywall

Re: phpBB logon not logging into Simple Membership paywall

by pennymachines » Tue Jun 10, 2025 3:56 pm

... but is it the correct behavior of Simple Membership, so to say, if you login into a subsite that's not with Simple Membership activated, and the integration plugin is not active, it let you see the content of the site where the user is not registered in?
It's complicated...

At present, logging in from subsite2 (where Simple Membership is not activated), the users is logged into subsite1 (where Simple Membership is activated) and can see Simple Membership content if they are subscribed, but this only works because of another hack in WP functions.php which handles the login, forcing it to go through https://mysite.com/subsite1/wp-login.php

If I removed this function, and a user logged in from https://mysite.com/subsite2/wp-login.php, that user would not be logged into Simple Membership content at https://mysite.com/subsite1
They would have to log in via https://mysite.com/subsite1/wp-login.php
This is true whether WordPress w3all phpBB integration is network activated or not.

So in short, logging into Simple Membership only works from the WP subsite on which that plugin is active. (My phpBB and WP functions.php hacks get around this problem).

Re: phpBB logon not logging into Simple Membership paywall

by axew3 » Mon Jun 09, 2025 3:34 pm

When you login in phpBB, there are only 3 cookies released by phpBB:
K, sid, and u

When you navigate WP, it release the wordpress_test_cookie (wp only works with cookie for the user auth process, if they are disabled the WP login simply do not work).
When you login in WP, the plugin, again only set up
k, sid, and u phpBB cookies, all others on list you see are released by WP (two more if not wrong by wp) and all the remaining are released by others WP plugins.

I have read again your post above and i did not realized this:
If, on the other hand, they log in from https://mywebsite.com/subsite1/wp-login.php, (the subsite where Simple Membership is activated) they are logged into phpBB, WP, and WP Simple Membership.

So as you did the hack to fix this situation is perfectly ok
, but
is it the correct behavior of Simple Membership, so to say, if you login into a subsite that's not with Simple Membership activated, and the integration plugin is not active, it let you see the content of the site where the user is not registered in?

Re: phpBB logon not logging into Simple Membership paywall

by pennymachines » Mon Jun 09, 2025 1:49 pm

OK, thanks.

I uncommented the line in private static function verify_phpbb_credentials() but it made no difference (tested in Firefox and Chrome).

When user logs into phpBB using the default software, cookies created look something like this:
myforumcookies_k (no value)
myforumcookies_sid (sid alphanumeric string value)
myforumcookies_u (numeric value)
wordpress_test_cookie (WP%20Cookie%20check)

No other related cookies.

When a user logs into phpBB using my WP iframe hack or Wordpress, cookies created look something like this:
__wpdm_client (alphanumeric string value)
PHPSESSID (sid alphanumeric string value)
myforumcookies_k (alphanumeric string value)
myforumcookies_sid (sid alphanumeric string value)
myforumcookies_u (numeric value)
simple_wp_membership_sec_(alphanumeric_string)
swpm_in_use (swpm_in_use)
swpm_session (alphanumeric string value)
wfwaf-authcookie-(alphanumeric_string)
wordpress_logged_in_(alphanumeric_string)
wordpress_sec_(alphanumeric_string)
wordpress_test_cookie (WP%20Cookie%20check)
wp_swpm_in_use (wp_swpm_in_use)

Re: phpBB logon not logging into Simple Membership paywall

by axew3 » Sun Jun 08, 2025 10:11 am

So, as you describe the behavior, it could be this the reason, and maybe two because i noted also another thing but i have to return over into a MUMS and test it, if you are not against it, and since many years ago you gave me the possibility to access to your test environment, i will maybe ask you again to look and definitively fix reversing the issue. So i will not become crazy on re-create your scenario. Promised that this time we will not fail on detect and fix in minutes ;)
Let me please finish with snippets i am preparing for phpBB so to make it like Discourse in some aspect, and we will go for 3.0.0 that aim to be absolutely perfect, i hope into any scenario and plugin. I am going crazy on looking these days how phpBB could much better in few easy steps.

Anyway, returning to your issue and MUMS with Simple Membership, and what you say about cookie... the plugin code work like this so we could argue maybe, maybe not, but it would be the first thing i would go to see, if the history about cookie is true, probably this happen?...(so maybe you can test)

WHEN a login is DONE in phpBB, phpBB release the session cookie. AT this time the user is only logged in phpBB.
If you are on iframed phpBB, the WP page reload, so it seem all happen at same time, login phpBB and WP but the true obviously is, that the parent WP page containing the iframed phpBB reload, the phpBB released the cookie, so the plugin WP code recognize the cookie through , and login him into WP.
If you are not in iframe, WHEN the user so navigate to WP, if there is a presented cookie uid > 2 and a session cookie, then as above, the plugin code check the session cookie, and if there is a match it login the user again THROUGH the
private static function verify_phpbb_credentials(){
on file class.wp.w3all-phpbb.php

exactly here, if the login in WP happen not due to an user login action in a WP form, but because a phpBB valid session cookie is presented, the code into the private static function verify_phpbb_credentials(){ do this:

Code: Select all

    $remember = ( empty($phpbb_k) ) ? false : 1;
    wp_set_current_user( $wpuID, '' );
    wp_set_auth_cookie( $wpuID, $remember, is_ssl() );

     if(!defined("PHPBBAUTHCOOKIEREL")){
      define("PHPBBAUTHCOOKIEREL",true);
     }

       if ( !defined( 'WP_ADMIN' ) ) // or throw Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "wp_w3all_phpbb_login" not found or invalid function name ...
       {
        #do_action( 'wp_login', $user->user_login, $user ); # removed
       }
into this, NOTE this commented line of code:

Code: Select all

#do_action( 'wp_login', $user->user_login, $user ); # removed
change into

Code: Select all

do_action( 'wp_login', $user->user_login, $user );
try to restore it

Could you please check if it is the reason of the problem?
Because when a login is done via a presented session cookie, the private static function verify_phpbb_credentials(){ here, do not "propagate" informing all the other code, that the user is being logged in, SO MAYBE, SImple Membership in this case, DO NOT RELEASE his cookie, because has not been noticed of a successful user login?
what inform all others plugins that there is a login is this line:

Code: Select all

do_action( 'wp_login', $user->user_login, $user );
I remember that i removed it probably, because until latest fixes about to make the code running fine into any scenario, because if an hooked function is called before the init, the code anyway instantiate a db connection and do not fail like before, probably now can be restored so to have a more correct flow.

When a login is done in WP, the plugin code release a phpBB cookie AFTER the WP login flow finished, so maybe if the problem is coming out also when logging into WP side, but only in certain MUMS subsites, probably again it is given by something that the Simple Membership do not recognize but the behavior of why this is caused, is a little bit more complicate to explain, even if easy to be fixed in necessary.
Please check if the above fixed as i hope/think!

Let know!

Re: phpBB logon not logging into Simple Membership paywall

by pennymachines » Sat Jun 07, 2025 1:15 pm

Hi Alessio,

Thanks for your response. My apologies for being so slow seeing it.

I don't think it's related to that previous logout issue.

I think the problem is that Simple Membership uses a cookie that the standard WP login does not.

If, for example, a user logs in from https://mywebsite.com/subsite2/wp-login.php, they are logged into phpBB, WPs, but not Simple Membership content (even when they have a Simple Membership subscription).

Likewise, if they log in from https://mywebsite.com/phpbb/index.php, they are logged into phpBB, WP, but not WP Simple Membership content.

If, on the other hand, they log in from https://mywebsite.com/subsite1/wp-login.php, (the subsite where Simple Membership is activated) they are logged into phpBB, WP, and WP Simple Membership.

Currently I solve the problem with an awkward hack. I modified the phpBB login modal so that it is an iframe of subsite1 which contains the https://mywebsite.com/subsite1/wp-login.php login form.

Re: phpBB logon not logging into Simple Membership paywall

by axew3 » Sun May 18, 2025 7:04 am

Hello David.
About that you reported, i am over coming 2.9.7 (that will surprise you looking on how it has been little changed so to have great benefits in term of simplicity and understand how the code is organized) and i noted this:
viewtopic.php?p=6971#p6971

The user "seem" logged out but in true is logged in, but redirected to the wp-login page where it seem to be logged out because the login form display.
So i am asking myself if it could be linked to the same problems you reported?

Top