Guest User

Untitled

a guest
Jul 31st, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  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 );
Advertisement
Add Comment
Please, Sign In to add comment