WordPress.org

Forums

How to redirect user to their primary blog dashboard on login to main site? (2 posts)

  1. Dan & Jennifer
    Member
    Posted 3 years ago #

    Hi guys!

    On a domain-based WP Multisite (running latest WP), how can I allow users to login to the main site, but be automatically redirected to their own primary blog dashboard?

    The same way WordPress.com works, to make it intuitive: one place to login, but you get redirected to the correct dashboard.

    By default logging into the main site puts the user in the dashboard for the main site, and just tells them they have no privileges there.

    Thanks!
    Dan

  2. http://codex.wordpress.org/Function_Reference/wp_login_form

    There's a redirect function, so you'd be using <?php wp_login_form( redirect='http://example.com/mypage/' ); ?>

    But how to get the URL, you may ask, and that's where it gets messy :/

    See http://codex.wordpress.org/WPMU_Functions/get_active_blog_for_user would be my first guess, but you need to know the user ID, which you don't know till you log in, unless you want to do a check 'what user ID matches this username'

    How are they logging in now? Via a form or the normal wp-login.php?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.