Guest User

Untitled

a guest
Jun 19th, 2013
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  8. echo "HERE WE GO...";
  9. echo "<PRE>"; print_r($bp->groups->current_group); echo "</PRE>";
  10. echo $bp->groups->current_group->status;
  11. echo $bp->groups->current_group->is_user_member;
  12.  
  13. if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
  14. echo "<PRE>"; print_r($bp->bp_options_nav); echo "</pre>";
  15. exit();
  16. if ($bp->bp_options_nav['groups']['announcements']['slug']) {
  17. bp_core_redirect( $path . $bp->bp_options_nav['groups']['announcements']['slug'] . '/' );
  18. } else {
  19. bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
  20. }
  21. bp_core_redirect( $path . 'welcome/' ); //quick hack for some other tab
  22. }
  23. }
  24. }
  25.  
  26. function bphelp_custom_toolbar($wp_toolbar) {
  27. global $wp_admin_bar;
  28.  
  29. if ( !current_user_can( 'manage_options' ) ) {
  30. $wp_toolbar->remove_node('site-name');
  31. }
  32. }
  33.  
  34. add_action('admin_bar_menu', 'bphelp_custom_toolbar', 999);
  35.  
  36. ?>
RAW Paste Data