WP MultiSite - User...
 
Notifications
Clear all

wpForo 1.x.x [Solved] WP MultiSite - User registration issue?

7 Posts
3 Users
2 Likes
491 Views
Hansie
Posts: 18
Topic starter
(@hansie)
Active Member
Joined: 6 years ago

Dear WPForo team,

Trying to resolve an issue with MultiSite user registration activation (see this post in the forum), I noticed something that may be a bug or not. Please correct me if I'm wrong.

For MultiSite users, and email activation enabled, the function wpmu_signup_user should be used.
This creates an entry in wp_signups and send an activation email to the user.
Once the user clicks the activation link in this email, the user will be added to the users tabel wp_users.

However, with the current WPForo version (1.9.3) the function register_new_user is being used which right away adds the user to wp_users and does not send an activation email an there will be no entry in wp_signups - the new user can never activate his or her account.

Modifying the original code of a plugin is not something I can recommend to anyone, but while testing this on my test server the following changes worked by modifying wpforo/wpf-includes/class-members.php around line 263 where you'll find:

$user_id = register_new_user( $user_fields['user_login'], $user_fields['user_email'] );
if ( !is_wp_error( $user_id ) && $user_id ) {
do_action( 'wpforo_create_user_after', $data );
WPF()->notice->clear();
WPF()->notice->add('Success! Please check your mail for confirmation.', 'success');
return $user_id;
}

I've modified the code to this for testing:

if( is_multisite() ) {
wpmu_signup_user($user_fields['user_login'], $user_fields['user_email']);
WPF()->notice->clear();
WPF()->notice->add('Success! Please check your mail for confirmation.', 'success');
return TRUE;
} else {
$user_id = register_new_user( $user_fields['user_login'], $user_fields['user_email'] );
if ( !is_wp_error( $user_id ) && $user_id ) {
do_action( 'wpforo_create_user_after', $data );
WPF()->notice->clear();
WPF()->notice->add('Success! Please check your mail for confirmation.', 'success');
return $user_id;
}
}

And now User signup with email activation works correct on my WP Multisite setup.

Please correct me if I'm wrong - I'm not a coding expert and most certainly will not claim to know much about the inner workings of WPForo. 

6 Replies
Sofy
Posts: 4057
 Sofy
Admin
(@sofy)
Support Team
Joined: 5 years ago

@hansie,

The latest versions are not well tested with WordPress multisites. 

The solution found by you is approved by our developers. They found it as a good solution. 

We've added in our to-do list this issue. We'll test and solve all issues with multisites in the next version of the wpForo. 

Reply
Hansie
Posts: 18
Topic starter
(@hansie)
Active Member
Joined: 6 years ago

Thanks Sofy! 👍 🙂 

Reply
Hansie
Posts: 18
Topic starter
(@hansie)
Active Member
Joined: 6 years ago

I just installed WPForo 1.9.4, where this fix was included.
However, the implemented fix doesn't work.
The email is still not send to the user to activate.

However, I did find the culprit.

In the file class-members.php, line 263, the devs wrote:

if( is_multisite() && apply_filters('wpforo_mu_signup', false) ){

This somehow prevents the activation email from being send and we're back to the same behavior as before (not sure what the apply_filters does).

After changing that line to:

 if( is_multisite() ) {   

things work correctly again. ( I removed " && apply_filters('wpforo_mu_signup', false)" )

I realize you guys may not have access to Multisite setups, so I hope this is helpful for you.

Reply
1 Reply
Robert
Admin
(@robert)
Joined: 7 years ago

Support Team
Posts: 9912
Posted by: @hansie

things work correctly again. ( I removed " && apply_filters('wpforo_mu_signup', false)" )

Don't do this please. This is a hook to enable it using a hook. Don't do any change in the core. Revert it back asap and use this code in your active WordPress theme functions.php file:

add_filter('wpforo_mu_signup', '__return_true' );
Reply
Hansie
Posts: 18
Topic starter
(@hansie)
Active Member
Joined: 6 years ago

Thanks Robert,

Some times I temporary have to change something in the core files to make sure my website works. I'd rather not of course - that's why I'm reporting findings here, as it may help make WPForo better. 😊 

I've revert back to the original code and added the add_filter to my functions.php, and your suggestion works. 👍 

On that note: I doubt folks would like to do this for their multisite setups.
After all, if they use a theme, and update would potentially overwrite their functions.php.

Or ... did I overlook a setting that has become available in the latest WPForo version (1.9.4)?

Reply
1 Reply
Robert
Admin
(@robert)
Joined: 7 years ago

Support Team
Posts: 9912

Ok, thank you @hansie,

There is no setting for this. The only way is using this hook.

Reply