Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirecting to profile page after login


  • Kailas
    Participant

    @kailasr

    Hi,

    I searched and couldn’t find answer for this question.

    How do I redirect users to their profile page instead of blogs list after login?

    Thanks

    Kailas

Viewing 15 replies - 1 through 15 (of 15 total)

  • modemlooper
    Moderator

    @modemlooper

    Search this forum its already been posted before as most topics have :)


    Kailas
    Participant

    @kailasr

    Hello Modemlooper,

    I am sorry I couldn’t narrow down the post that explains this. Do you have it on top of your head as to how to do it or link to the discussion?

    Thanks


    edelwater
    Participant

    @edelwater

    unfortunately this thread comes #1 in Google when searching on the topic…


    jivany
    Participant

    @jivany


    peterverkooijen
    Participant

    @peterverkooijen

    Brajesh Singh’s plugin:

    add_filter("login_redirect","bpdev_redirect_to_profile",10,3);

    function bpdev_redirect_to_profile($redirect_to_calculated,$redirect_url_specified,$user)
    {
    if(empty($redirect_to_calculated))
    $redirect_to_calculated=admin_url();

    /*if the user is not site admin,redirect to his/her profile*/
    if(!is_site_admin($user->user_login))
    return bp_core_get_user_domain($user->ID );
    else
    return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/

    }

    I put it in bp-custom.php. Probably also works in functions.php.

    He also has this essential logout redirect to homepage plugin. Both should have been default wp/bp behavior imho.


    jivany
    Participant

    @jivany

    Both should have been default wp/bp behavior imho.

    I’ll disagree with that. ;) Especially with sites where you use the bp-default theme style of having a login box on every page. I don’t want to be redirected to my profile page if there is a reason I’m logging in on page X.

    Redirecting to the user’s profile page makes sense on a closed/private installation where you need to login to see anything (ala Facebook)


    thenone
    Participant

    @thenone

    brajesh: this redirect code is meant for WPMU right? I’m looking for single wordpress 2.9.2, does anyone have a solution for it?


    techguy
    Participant

    @crashutah

    @thenone This redirect works for both MU and WP.


    thenone
    Participant

    @thenone

    @techguy : I tried, but it wont work, instead of that I got a “fatal error” message on dashboard, is this got anything to do with web server “PHP/Apache” configuration to support certain php module?

    Hey All,
    Im using WordPress 3.0.1 with BuddyPress 1.2.5.2. I have used the WP-FB-AutoConnect to allow users to login using their facebook accounts and it works absolutely fine. However my issue is that I want users who login for the first time (those who login through the facebook connect) to go first to their profile page and fill out the additional details in their profile and update their facestreem and tweetsream settings. Any idea how to do this?
    Your help would be MUCH MUCH appreciated.

    UPDATE!

    I know this hasn’t been updated in 7 months, but I needed this feature and none of the plugins and mods here worked, but I figured out a way and wanted to share it.

    Add this before HTML tag in your theme’s header.php file. (Note: Be sure to replace YOUR_DOMAIN_NAME with the domain of your buddypress installation.)

    `<?php
    global $post;
    if ( is_home()) { ?>

    user_login; ?>

    <?php
    } else {
    // User is not logged in – Display homepage
    }
    ?>`

    Now I’m using a plugin called Branded Login for Buddypress by Brajesh Singh — This plugin includes `<input type="hidden" name="redirect_to" value="” />` on the login.php file but I’m pretty sure the normal BP login form has this as well so it should work.

    Result summary:

    After login the script checks if the current page is the site HOME page, if true it runs another script to see if the user is logged in, if the user is logged in it redirects them to there profile page. if the user is not logged in, or it is not the HOME page it does nothing and loads the page normally.

    End Result: Instantly takes user to profile page after login, and if they try to reach the site homepage its now there profile page.

    Hope this helps! working wonders for me :)


    archonic
    Participant

    @archonic

    Here’s a version with less ‘s :)

    `<?php
    global $post;
    if ( is_home()) {
    global $current_user;
    $log = $current_user->user_login;
    if ( is_user_logged_in() ) :
    header(‘Location: http://www.YOUR_DOMAIN_NAME.com/members/&#8217;.$log);
    else :
    header(”);
    endif;
    } else {
    // User is not logged in – Display homepage
    }
    ?>`

    I’m looking to do something similar. Instead of going to the members profile page, I’d like to redirect members to their “default” group. It looks like I’ll need to write a short plugin which stores links between members and their default group in the custom user meta and allow that default to be edited in their profile.


    Jigesh
    Participant

    @jigesh

    Hello, i have got another way to redirect user to show all activity
    1) Install BP-PROFILE-AS-HOMEPAGE plugin

    2) INSTALL PLUGIN

    3) in admin dashboard where list of plugin is listed you will find BP PROFILE AS HOMEPAGE PLUGIN, under it THERE IS TWO OPTION deactivate & edit

    4) click on EDIT

    5) Replace following line

    wp_redirect( $bp->loggedin_user->domain );

    WITH THIS

    wp_redirect( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . ‘/’ . BPCOM_ACTIVITY_SLUG );

    6) You are Surely done. It works 100 Percent. i have also used help from this forum i am thank ful about it.
    Anyone facing problem mail me on jigesh.raval@gmail.com


    williamhussey
    Participant

    @williamhussey

    Im trying to automatically redirect to the forum. Same process? Any tips?


    williamhussey
    Participant

    @williamhussey

    Im trying to automatically redirect to the forum. Same process? Any tips?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Redirecting to profile page after login’ is closed to new replies.
Skip to toolbar