Simple Memberships - Login Logout Autologin fixes
-
pennymachines
- w3 User

- Posts: 112
- Joined: Mon Feb 06, 2017 9:51 pm
Re: Simple Memberships - Login Logout Autologin fixes
OK thanks. I have updated to Version 3.2.0 and cross-checked custom_functions.php against the code you posted above. When user logs in via phpBB the are logged into WP subsite 6 (museum), but they are not logged into WP subsite 5 (archive), nor WP subsite 9 (calendar), nor WP subsite 7 (arena), nor Simple Membership on that subsite. Do I need to modify/edit the custom_functions.php? What am I missing here?
-
axew3
- w3all User

- Posts: 3103
- Joined: Fri Jan 22, 2016 5:15 pm
- Location: Italy
- Skype: axewww
Re: Simple Memberships - Login Logout Autologin fixes
Nothing, the code works as is actually on 3.2.0
https://plugins.trac.wordpress.org/brow ... ctions.php
the simple function that add logged in users to any blog they visits, is this
Do you want the user added into all blogs when they visits as logged or login into the first one?
[UPDATED]
https://plugins.trac.wordpress.org/brow ... ctions.php
the simple function that add logged in users to any blog they visits, is this
Code: Select all
# WP MUMS Multisite: addition of the phpBB user presenting valid credentials into any WP subsite as subscriber
# without having to login (example)
add_action( 'init', 'w3_add_phpbbUser_anyBlog');
function w3_add_phpbbUser_anyBlog() {
global $w3all_phpbb_usession;
if ( is_multisite() && !empty($w3all_phpbb_usession) && ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) {
$role = 'subscriber';
$result = add_user_to_blog(get_current_blog_id(), get_current_user_id(), $role);
}
}
Code: Select all
# WP MUMS Multisite: addition of the phpBB user presenting valid credentials into any WP subsite as subscriber
# without having to login (example)
add_action( 'init', 'w3_add_phpbbUser_anyBlog');
function w3_add_phpbbUser_anyBlog() {
global $w3all_phpbb_usession;
if ( is_multisite() && !empty($w3all_phpbb_usession) && ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) )
{
$role = 'subscriber';
# Single blog insertion
#add_user_to_blog(get_current_blog_id(), get_current_user_id(), $role);
# Multiple blogs insertion
$user_id = get_current_user_id();
$sites = get_sites( array( 'fields' => 'ids',
// 'number' => 0, // Setting 'number' to 0 removes the default 100-site boundary limit
) );
if ( ! empty( $sites ) && is_array( $sites ) ) {
foreach ( $sites as $site_id ) {
add_user_to_blog( $site_id, $user_id, $role );
}
}
}
}-
pennymachines
- w3 User

- Posts: 112
- Joined: Mon Feb 06, 2017 9:51 pm
Re: Simple Memberships - Login Logout Autologin fixes
Yes, on my setup all users are registered through Simple Membership and automatically become members of phpBB and all Wordpress subsites (as role 'author'). They can log in via phpBB or any Wordpress subsite (including Simple Membership on the arena subsite) and are then automatically logged in everywhere on the site.
I've edited custom_functions.php accordingly. Good news! Logging in and out seems to function 100%. (I haven't tested creating a new member yet, but I don't expect problems there). I'm not sure if I should tempt fate by suggesting this is now fully resolved...
Thank you again Alessio for w3all and all your fantastic support.
I've edited custom_functions.php accordingly. Good news! Logging in and out seems to function 100%. (I haven't tested creating a new member yet, but I don't expect problems there). I'm not sure if I should tempt fate by suggesting this is now fully resolved...
Thank you again Alessio for w3all and all your fantastic support.
-
axew3
- w3all User

- Posts: 3103
- Joined: Fri Jan 22, 2016 5:15 pm
- Location: Italy
- Skype: axewww
Re: Simple Memberships - Login Logout Autologin fixes
Thank to you for your patience on this
wow
Let say we have finally after long time find out the way to make it work everywhere and with easy any default WP or MU MS, with any plugin.
If you require examples for any needs just post the issue and we'll fix immediately!
Glad that finally a way to start on rewrite all as it require to be has began.
How to for common problems and
Simple Membership Login Logout issues fixes
Let say we have finally after long time find out the way to make it work everywhere and with easy any default WP or MU MS, with any plugin.
If you require examples for any needs just post the issue and we'll fix immediately!
Glad that finally a way to start on rewrite all as it require to be has began.
How to for common problems and
Simple Membership Login Logout issues fixes