admin管理员组文章数量:1122846
In my multisite i'm using a custom blog registration using :
wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
and the site creation is successfull.
and i want users automatically sign into their site admin panel on signup,for that i use :
$creds = array();
$creds['user_login'] = $_POST['username'];
$creds['user_password'] = $_POST['password'];
$creds['remember'] = true;
$user = wp_signon( $creds, false );
if ( is_wp_error($user) )
echo $user->get_error_message();
But this will return an error :
ERROR: The password you entered for the username mysite is incorrect. Lost your password?
i need auto signin without using a plugin!!!
Please help...
In my multisite i'm using a custom blog registration using :
wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
and the site creation is successfull.
and i want users automatically sign into their site admin panel on signup,for that i use :
$creds = array();
$creds['user_login'] = $_POST['username'];
$creds['user_password'] = $_POST['password'];
$creds['remember'] = true;
$user = wp_signon( $creds, false );
if ( is_wp_error($user) )
echo $user->get_error_message();
But this will return an error :
ERROR: The password you entered for the username mysite is incorrect. Lost your password?
i need auto signin without using a plugin!!!
Please help...
Share Improve this question edited Aug 11, 2011 at 5:51 Wyck 18k4 gold badges46 silver badges67 bronze badges asked Aug 11, 2011 at 5:19 SebinSebin 232 silver badges4 bronze badges 1- I am seeing the exact same issue. wp_signon does not seem to work for multisite setup. Did you found a solution? – ltfishie Commented Mar 2, 2012 at 21:15
2 Answers
Reset to default 3Hope this helps someone else. After hours of debugging, I found out that under multisite setup, wp_signon ($creds, false) will not log you in. So you should either do:
$user = wp_signon ($creds, false);
wp_set_auth_cookie($user->ID);
or
$user = wp_signon ($creds, true);
Since you are making them signed in after a successful blog creation, $_POST
variable won't have the values you are expecting it to.
Use wp_set_auth_cookie( $user_id );
and it will make your user logged in, you don't need to check for login credentials in your use case.
本文标签: multisitewpsignon( credsfalse ) not working
版权声明:本文标题:multisite - wp_signon( $creds, false ); not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736286445a1927671.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论