Skip to content

Instantly share code, notes, and snippets.

@sbruner
Created August 17, 2011 20:39
Show Gist options
  • Save sbruner/1152556 to your computer and use it in GitHub Desktop.
Save sbruner/1152556 to your computer and use it in GitHub Desktop.
WPNYC.ORG / BuddyPress: Redirect to forum on Group home page
<?php
/**
* Redirect to forum on Group home page
*
* http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/changing-group-tab-display-defaults/?topic_page=2&num=15
*/
function sfire_redirect_to_forum() {
global $bp;
$path = clean_url( $_SERVER['REQUEST_URI'] );
$path = apply_filters( 'bp_uri', $path );
if ( bp_is_group_home() && $bp->current_action == $bp->bp_options_nav['groups']['home']['slug'] )
bp_core_redirect( apply_filters( 'bp_uri', $bp->bp_options_nav['groups']['forum']['link']) );
}
add_action( 'bp_init', 'sfire_redirect_to_forum' );
?>
@daisypeel
Copy link

Something about this breaks the ability to post updates in a group's activity stream. Any advice? Thanks for the snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment