Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Wordpress multisite user registration and auto login WordPress

  • SOLVED

Hi all,

I'm building a multisite installation and need new users to be able to register and be logged in automatically. So the email activation step needs to be bypassed or automated, and also users need to choose their own password (I have already done this part).

Does anyone have the code to bypass or automate the activation step and log the user in automatically? Preferably in the form of a plugin, rather than hacking the core.

Thanks
Sean

Answers (7)

2012-06-28

Hardeep Singh answers:

Use this code as plugin
http://pastebin.com/se5NBVcH

Create a file in plugin folder and paste this code. Activate the plugin.

Details on the same can also be found in this thread:
http://wordpress.org/support/topic/help-need-registration-like-non-multi-site


Sean H comments:

Thanks Hardeep. This is very useful. I can now bypass activation. I still need to figure out the automatic login part but hopefully that will be a simple redirect after login.

Many thanks
Sean

2012-06-28

Francisco Javier Carazo Gil answers:

Have you tried this? http://wordpress.org/extend/plugins/dg-auto-login/


Sean H comments:

Thanks Francisco but that plugin doesn't support multisite.

2012-06-28

Arnav Joy answers:

are you using buddypress?

if yes then you can use this plguin

http://wordpress.org/extend/plugins/bp-disable-activation/


Arnav Joy comments:

check this link

http://mp-frontend.info/wordpress-marketplace-tutorial/remove-email-verification-set-password-on-wordpress-multisite-blog-creation/


Sean H comments:

Thanks Arnav but I'm not using Buddypress.

Also, the MarketPress plugin is for MarketPress sites only.

2012-06-28

Jerson Baguio answers:

In your create your use code something like this




$new_user = absint(wp_insert_user($userdata)); // $userdata array of user information

$user_info = get_userdata($new_user );
do_action('wp_signon', $user_info->user_login);
wp_set_auth_cookie($new_user , true, false);
wp_set_current_user($new_user r);


This will give the idea how its done


Sean H comments:

Thanks Jerson but there's more to it than that when you're edaling with multisite.

For a start in multisite the user chooses a domain name. Also, a successful signup results in the login details being added to a row in the signups table in the database. Only when the user activates his account, the details are moved into the users table.

This process is different to single (non-multisite) installations of Wordpress, which is why standard plugins will not work.


Jerson Baguio comments:

Yes i think it might work.. i used that code in one of my multi site project.. How you tried it?

In your multi site does it use multiple wp_users table?

2012-06-28

Jatin Soni answers:

Try this plugin maybe works for you
http://blog.coderaustralia.com/wordpress-plugins/wordpress-auto-login


Sean H comments:

Thanks Jatin but that plugin doesn't support multisite.

2012-06-28

Daniel Yoen answers:

if you use BP, try this function :


function disable_validation( $user_id ) {
global $wpdb;
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d", $user_id ) );
}
add_action( 'bp_core_signup_user', 'disable_validation' );
function fix_signup_form_validation_text() {
return >false;
}
add_filter( 'bp_registration_needs_activation', 'fix_signup_form_validation_text' );


hope this help :)


Sean H comments:

Thanks Daniel but I'm not using Buddypress.

2012-06-28

Gabriel Reguly answers:

Hi Sean,

This plugin can be useful: [[LINK href="http://gabriel.ppgr.com.br/register-plus-redux/"]]http://gabriel.ppgr.com.br/register-plus-redux/[[/LINK]]

Regards,
Gabriel


Sean H comments:

Thanks Gabriel, that does look like a useful plugin.

However there does seem to be a problem with its security at the moment, see this link: http://radiok.info/blog/where-redux-went/

Thanks anyway
Sean


Gabriel Reguly comments:

Hi Sean,

Indeed it has some issues and those are being addressed: http://radiok.info/blog/276/.

Please notice that my version of it adds the autologin feature and the security issues are not present if you do not use the unsecure features.

Anyway I can code it custom for you for a fixed price of $100.

Regards,
Gabriel


Sean H comments:

But the issues have not been addressed yet. Only yesterday the plugin author commented that he hasn't submitted the plugin to WordPress yet. And what do you mean by "my version"? As far as I can tell the author has removed the plugin from the website until he completes the work. Do you have another version of the plugin which is secure?

Thanks
Sean


Gabriel Reguly comments:

Hi Sean,

The folks from WordPress.org removed the plugin from the repository due the security issues.

It is a bad thing that they just removed the whole thing ( plugin code and page ) instead of just removing the code and posting a warning at the page.

From my site, you can read

<blockquote>

This page stores my changed versions of Register Plus Redux http://radiok.info/blog/still-kicking/

<strong>This is a fork</strong>, so class name has changed to RegisterPlusReduxAutoLoginPlugin to ensure it will not conflict with the original plugin.

Enjoy it.

= 3.8.1-role-by-invitation-code = October, 07 2011 by Gabriel Reguly
* Fixed jQuery UI Tabs issue, now it only loads for the plugin
= 3.8-role-by-invitation-code = October, 06 2011 by Gabriel Reguly
* Added role by invitation code option

http://gabriel.ppgr.com.br/wp-content/plugins/register-plus-redux-auto-login-3.8.1.zip

</blockquote>

So it is another version of the plugin, based on the original unsecure plugin, which adds the code you are looking for.

Indeed there is some insecure code inside it, but that is not used in the features you require, that is how I can say my version is safe.

Did I mentioned that I can custom code a plugin for you for a fixed fee of $100?

Regards,
Gabriel


Sean H comments:

Thanks Gabriel, I understand now. I must admit that despite your assurances, I'm still uneasy about having unsecure code on my site, even if it's an area of the code I do not plan to use right now.

Hardeep's solution above is very close to what I was asking for, except that it doesn't include the automatic login part. So I'm not sure I would need to pay $100 for the remainder of the solution, unless your offer was a general one in which case I will bear it in mind going forward.

Thanks
Sean


Gabriel Reguly comments:

Hi Sean,

Yes, I would provide the full solution for you in a plugin form.

As an alternative, you can dig into my plugin code and get there the pieces you need.

Regards,
Gabriel