Leave a comment

BuddyPress Redirect To Profile Trick Using A Landing Page.

Add the below code to bp-custom.php to redirect to profile upon login.Follow the instructions  in comments below:


// PLEASE NOTE FOR THIS TO WORK:
// Before adding this code to bp-custom.php
// http://codex.buddypress.org/developer/customizing/bp-custom-php/
// you will need to create a new page in the dashboard and name it
// something like "Welcome" for example or any name you choose.
// This will be your landing page. Add content and media if you
// like and publish the page. Then go to Dashboard/Settings/Reading.
// Under "Front page displays" select "A static page." Then use the
// "Front page" dropdown menu to select your page. In my example for
// instance I selected "Welcome" for my front page. Done! Now logged
// out visitors get your landing page, and logged in users get
// directed to their profile.

/* Redirects to profile upon login */
function bp_help_redirect_to_profile(){
global $bp;

if( is_user_logged_in() && bp_is_front_page() )
bp_core_redirect( get_option('home') . '/members/' . bp_core_get_username( bp_loggedin_user_id() ) . '/profile' );

}

add_action( 'get_header', 'bp_help_redirect_to_profile',1);

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: