Skip to content

Instantly share code, notes, and snippets.

@BoweFrankema
Created February 20, 2015 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoweFrankema/0969c4fc1e3aba6334ae to your computer and use it in GitHub Desktop.
Save BoweFrankema/0969c4fc1e3aba6334ae to your computer and use it in GitHub Desktop.
Redirect logged in users from the homepage to the activity stream.
<?php
function cfc_bp_profile_homepage()
//Redirect logged in users from homepage to activity. This happens after login or when a user tries to go back to the homepage.
{
global $bp;
if( is_user_logged_in() && is_front_page() && !get_user_meta( $user->ID, 'last_activity', true ) )
{
wp_redirect( network_home_url( $bp->activity->root_slug ), 301 );
exit();
}
}
add_action('wp','cfc_bp_profile_homepage');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment