Login message
-
Is there a way to allow a user to login to their site from your main site login screen.
I am designing a sub domain multisite and if I register a user + site and log that user in on mysite.com/wp-login.php It doesn’t redirect to the user site and get the following message:
You attempted to access the “my site” dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the “my site” dashboard, please contact your network administrator.
If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.
It then has links below the messsage to visit the user site and dashboard.
The user can log in straight away if the user logs in to the direct url to the site; usersite.mysite.com/wp-admin.php
This also seems to just be a sub-domain setup problem. If I create a sub-directory multisite install and register a new user + site, they can login on my main website; mywebsite.com/wp-login.php and it directs them straight to their admin; mywebsite.com/usersite/wp-admin.php.
Is this is what supposed to happen on sub-domain setup? If so, is there anyway to do a redirect so when they login they go straight to their site? there is this one:
function ds_login_redirect( $redirect_to, $request_redirect_to, $user ) { if ($user->ID != 0) { $user_info = get_userdata($user->ID); if ($user_info->primary_blog) { $primary_url = get_blogaddress_by_id($user_info->primary_blog) . 'wp-admin/'; if ($primary_url) { wp_redirect($primary_url); die(); } } } return $redirect_to; } add_filter('login_redirect','ds_login_redirect', 100, 3);
but you have to login twice with this code, once for the redirect to the users site url login page and then again to log in.
Any help with this will be much appreciated.
- The topic ‘Login message’ is closed to new replies.