Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 23rd, 2011  |  syntax: None  |  size: 1.41 KB  |  views: 72  |  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. <?php
  2. function redirect_group_home() {
  3.   global $bp;
  4.   $path = clean_url( $_SERVER['REQUEST_URI'] );
  5.   $path = apply_filters( 'bp_uri', $path );
  6.   if (bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false ) {
  7.     echo "HERE WE GO...";
  8.     echo "<PRE>"; print_r($bp->groups->current_group); echo "</PRE>";
  9.     echo $bp->groups->current_group->status;
  10.     echo $bp->groups->current_group->is_user_member;
  11.     if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
  12.       //echo "<PRE>"; print_r($bp->bp_options_nav); echo "</pre>";
  13.       //exit();
  14.       if ($bp->bp_options_nav['groups']['announcements']['slug']) {
  15.         bp_core_redirect( $path . $bp->bp_options_nav['groups']['announcements']['slug'] . '/' );
  16.       } else {
  17.         bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
  18.       }
  19.       bp_core_redirect( $path . 'welcome/' );
  20.     }
  21.   }
  22. }
  23. function move_group_activity_tab() {
  24.   global $bp;
  25.   if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
  26.     $bp->bp_options_nav['groups']['home']['position'] = '98';
  27.     $bp->bp_options_nav['groups']['admin']['position'] = '99';
  28.     $bp->bp_options_nav['groups']['home']['name'] = 'Activity Log';
  29.   }
  30. }
  31. add_action('wp', 'redirect_group_home' );
  32. add_action('bp_init', 'move_group_activity_tab');
  33. ?>
clone this paste RAW Paste Data