Simple Membership integration (WP-MUMS Multisite)

pennymachines
w3 User
w3 User
Posts: 112
Joined: Mon Feb 06, 2017 9:51 pm

Simple Membership integration (WP-MUMS Multisite)

Post by pennymachines »

axew3 wrote: Thu Jul 16, 2026 8:46 pm Hello!
How to fix the login of the user, when coming to WordPress side with a valid phpBB cookie.

First of all i note that if the user is not added as member into the Simple Membership members list, this will not work.
The user will be logged in WordPress and will stay logged but the user will not result as logged into the SM front end.
But so assuming that the user exists into the Simple Memberships list of active members, to fix the login you could do this (as ever there are more ways to achieve the same changing something else, and also possibles improvement to this basic example so to fit any requirement):

Open class.wp.w3all-phpbb.php
Search for this line:

Code: Select all

if( $current_user->user_email != $phpbb_user_session[0]->user_email )
Change into:

Code: Select all

if( $current_user->ID > 1 && $current_user->user_email != $phpbb_user_session[0]->user_email )
Then search for this line of code:

Code: Select all

$wpuID = !empty($wpuID) ? $wpuID : 0;
So assuming SM is installed and active, Just after add this:

Code: Select all

$auth = SwpmAuth::get_instance();
$auth->login_to_swpm_using_wp_user( get_user_by('id', $wpuID) );
This will login the user everywhere.

This topic will be now closed but another can be opened!
Hi Alessio,

I've opened a new Simple Membership topic having applied the code changes above.

Just to note, all member accounts on my site are created through the Simple Membership plugin. Registration is disabled in phpBB, so wp.w3all creates the phpBB membership. WP members have two levels of membership through Simple Membership: free and subscribed (for some WP paywall content).

Unfortunately, with the changes I'm getting a critical error:

Fatal error: Uncaught Error: Class "SwpmAuth" not found in /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:771 Stack trace: #0 /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(31): WP_w3all_phpbb::verify_phpbb_credentials() #1 /home/www/mysite.com/wp/wp-includes/class-wp-hook.php(341): WP_w3all_phpbb::wp_w3all_phpbb_init() #2 /home/www/mysite.com/wp/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters() #3 /home/www/mysite.com/wp/wp-includes/plugin.php(522): WP_Hook->do_action() #4 /home/www/mysite.com/wp/wp-settings.php(771): do_action() #5 /home/www/mysite.com/wp/wp-config.php(114): require_once('/home/www/mysite.com...') #6 /home/www/mysite.com/wp/wp-load.php(50): require_once('/home/www/mysite.com...') #7 /home/www/mysite.com/wp/wp-blog-header.php(13): require_once('/home/www/mysite.com...') #8 /home/www/mysite.com/index.php(17): require('/home/www/mysite.com...') #9 {main} thrown in /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 771
User avatar
axew3
w3all User
w3all User
Posts: 3103
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Skype: axewww

Re: Simple Membership integration

Post by axew3 »

Into the file wp-w3all.php

Code: Select all

add_action( 'init', array( 'WP_w3all_phpbb', 'wp_w3all_phpbb_init'), 3);
maybe change into

Code: Select all

add_action( 'init', array( 'WP_w3all_phpbb', 'wp_w3all_phpbb_init'), 10);
or into

Code: Select all

add_action( 'plugins_loaded', array( 'WP_w3all_phpbb', 'wp_w3all_phpbb_init'));
??
pennymachines
w3 User
w3 User
Posts: 112
Joined: Mon Feb 06, 2017 9:51 pm

Re: Simple Membership integration

Post by pennymachines »

I tried both but both returned the same errors as before...
User avatar
axew3
w3all User
w3all User
Posts: 3103
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Skype: axewww

Re: Simple Membership integration

Post by axew3 »

If SwpmAuth do not result to be included using

Code: Select all

add_action( 'init', array( 'WP_w3all_phpbb', 'wp_w3all_phpbb_init'), 10);
maybe the reason is this
The Simple Membership plugin initializes and makes its SwpmAuth class available during the standard WordPress init hook, which executes at a default priority of 10
so change into priority of 11 to be sure it will be available at the time it will be invoked inside the integration code

Code: Select all

add_action( 'init', array( 'WP_w3all_phpbb', 'wp_w3all_phpbb_init'), 11);
or 20.

This problem do not come out into my localhost tests. Even using the priority of 3 for the 'WP_w3all_phpbb', 'wp_w3all_phpbb_init', that's very strange.
pennymachines
w3 User
w3 User
Posts: 112
Joined: Mon Feb 06, 2017 9:51 pm

Re: Simple Membership integration

Post by pennymachines »

Sorry to report... but same error!
User avatar
axew3
w3all User
w3all User
Posts: 3103
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Skype: axewww

Re: Simple Membership integration

Post by axew3 »

It seem there are many problems!
As said into mine it works even without changing this last part and do no return error (i can admit it is strange).
But applied the above, there is some other strange reason that's apparently impossible, and that so cause your issue.
If SwpmAuth is added before as priority 10 as default it is
but you changed to be

Code: Select all

add_action( 'init', array( 'WP_w3all_phpbb', 'wp_w3all_phpbb_init'), 11);
it seem a nonsense that SwpmAuth::get_instance(); result to be not available at the time it is fired inside the WP_w3all_phpbb class called with priority 11. Except if the SM plugin is not active or some other code prevent the SM execution somehow or it is queued to be executed after for a reason that i ignore without testing it.