Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Redirecting to profile page after login (16 posts)

Started 2 years, 7 months ago by: Kailas

  • Profile picture of Kailas Kailas said 2 years, 7 months ago:

    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

  • Profile picture of modemlooper modemlooper said 2 years, 7 months ago:

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

  • Profile picture of Kailas Kailas said 2 years, 7 months ago:

    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

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

  • Profile picture of jivany jivany said 2 years, 1 month ago:

    Searching works but so does following tags.

    http://buddypress.org/forums/topic/two-questions-about-the-login-process#post-8380

  • 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.

  • Profile picture of jivany jivany said 2 years, 1 month ago:

    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)

  • Profile picture of thenone thenone said 1 year, 11 months ago:

    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?

  • Profile picture of techguy techguy said 1 year, 11 months ago:

    @thenone This redirect works for both MU and WP.

  • Profile picture of thenone thenone said 1 year, 11 months ago:

    @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?

  • Profile picture of Siddharth Bhansali Siddharth Bhansali said 1 year, 9 months ago:

    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.

  • Profile picture of msullens88 msullens88 said 1 year, 1 month ago:

    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()) { ?>
    <?php global $current_user; ?>
    <?php $log = $current_user->user_login; ?>
    <?php if ( is_user_logged_in() ) : ?>
    <?php header('Location: http://www.YOUR_DOMAIN_NAME.com/members/&#039;.$log); ?>
    <?php else : ?>
    <?php header(''); ?>
    <?php endif; ?>
    <?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="<?php bloginfo('url'); ?>" /> 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 :)

  • Profile picture of archonic archonic said 10 months, 1 week ago:

    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/&#039;.$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.

  • Profile picture of jigesh jigesh said 10 months ago:

    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

  • Profile picture of williamhussey williamhussey said 10 months ago:

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