Simple Membership integration (WP-MUMS Multisite)

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

Re: Simple Membership integration (WP-MUMS Multisite)

Post by pennymachines »

axew3 wrote: Fri Jul 24, 2026 9:16 pm Except if the SM plugin is not active or some other code prevent the SM execution somehow...
Reading that, I realized of course the SM plugin is not active on most of the subsites, only on the main subsite.

So testing code changes again:

if user logs in from phpBB and goes to WP subsites where SM plugin is not enabled, the critical error (as above) occurs and the user is logged out of phpBB and WP.

if user logs in from phpBB and goes to WP subsite where SM plugin is enabled, no critical error occurs, but user is logged out of phpBB and WP.

if user logs in from WP subsite where SM plugin is enabled, there are no problems. User stays logged into their WP Simple Membership account, WP and phpBB.
User avatar
axew3
w3all User
w3all User
Posts: 3064
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Simple Membership integration (WP-MUMS Multisite)

Post by axew3 »

Forgive the delay.
You should wrap the code instructions that calls SwpmAuth (SM plugin class) into

Code: Select all

if (class_exists('SwpmAuth')) {
  ....
}

Code: Select all

if (class_exists('SwpmAuth')) {
 $auth = SwpmAuth::get_instance();
 $auth->login_to_swpm_using_wp_user( get_user_by('id', $wpuID) );
}
So that into Subsites where the Simple Memberships is not active the code will not run and will not cause any error.
Post Reply