Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 31st, 2012  |  syntax: None  |  size: 1.00 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Buddypress - Groups navigation / redirect to forum (this again)
  2. function redirect_to_forum() {
  3.         global $bp;
  4.  
  5.         $path = clean_url( $_SERVER['REQUEST_URI'] );
  6.  
  7.         $path = apply_filters( 'bp_uri', $path );
  8.  
  9.         if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false )
  10.                 bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
  11. }
  12. add_action( 'wp', 'redirect_to_forum' );
  13.        
  14. function redirect_to_forum() {
  15.     global $bp;
  16.  
  17.     $path = clean_url( $_SERVER['REQUEST_URI'] );
  18.  
  19.     $path = apply_filters( 'bp_uri', $path );
  20.  
  21.     if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false )
  22.                 bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . 'forum/' );
  23. }
  24. add_action( 'bp_init', 'redirect_to_forum' );
  25.        
  26. elseif ( bp_group_is_visible() ) :
  27. locate_template( array( 'groups/single/** change this to any file within /single/ **' ), true );