Redirecting logged in users to a page other than dashboard/profile? (3 posts)

  1. joelholland
    Posted 8 years ago #

    We are using our blog as somewhat of a file management tool where visitors can register and then download files. Because of this, we do not want them landing on the WP Dashboard or Profile page once they login.

    Is there a plugin or simple hack that can direct users to a specified page, or even the home page, after logging in?


    - Joel

  2. Fiflak
    Posted 8 years ago #

    Yeah, good question, I would like to use that trick too. Any ideas? Anyone?

  3. Fiflak
    Posted 8 years ago #

    it's all here: http://blog.koloda.pl/wordpress-panel-logowania.html
    in case you don't know Polish, here is what you have to do:

    open wp-login.php and find the line with "case 'login' :" below that you have a code executed when someone tries to log in. You have to look for something like:

    if ( !isset( $_REQUEST['redirect_to'] ) )
    $redirect_to = 'wp-admin/';
    $redirect_to = $_REQUEST['redirect_to'];

    and change it to:

    if ( !isset( $_REQUEST['redirect_to'] ) || empty( $_REQUEST['redirect_to'] ) )
    $redirect_to = get_settings('siteurl').'/';
    $redirect_to = rawurldecode( $_REQUEST['redirect_to'] );

    Check if users who have permission to add/edit posts are also redirected to proper side. If not you have to comment the line:

    /* if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
    $redirect_to = get_option('siteurl') . '/wp-admin/profile.php'; */

    It may be a bit differed in wordress 2.6, but I guess you will have to use your brain and find similarities.

Topic Closed

This topic has been closed to new replies.

About this Topic