Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function redirect_group_home() {
- global $bp;
- $path = clean_url( $_SERVER['REQUEST_URI'] );
- $path = apply_filters( 'bp_uri', $path );
- if (bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false ) {
- echo "HERE WE GO...";
- echo "<PRE>"; print_r($bp->groups->current_group); echo "</PRE>";
- echo $bp->groups->current_group->status;
- echo $bp->groups->current_group->is_user_member;
- if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
- //echo "<PRE>"; print_r($bp->bp_options_nav); echo "</pre>";
- //exit();
- if ($bp->bp_options_nav['groups']['announcements']['slug']) {
- bp_core_redirect( $path . $bp->bp_options_nav['groups']['announcements']['slug'] . '/' );
- } else {
- bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
- }
- bp_core_redirect( $path . 'welcome/' );
- }
- }
- }
- function move_group_activity_tab() {
- global $bp;
- if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
- $bp->bp_options_nav['groups']['home']['position'] = '98';
- $bp->bp_options_nav['groups']['admin']['position'] = '99';
- $bp->bp_options_nav['groups']['home']['name'] = 'Activity Log';
- }
- }
- add_action('wp', 'redirect_group_home' );
- add_action('bp_init', 'move_group_activity_tab');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement