Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

#3719 closed defect (bug) (no action required)

Certain group tab start help for a plug in

Reported by: timcarey's profile TimCarey Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Groups Keywords:
Cc:

Description

I am the creator of the BP Group frontpage plug in. In the code of my plug in I make sure that the tab related to my plug in comes up first when someone goes to a group instead of home. Since version 1.5 this is not happening. I really could use any advice you can give relating to this. My code that I used to accomplish the certain tab come up first task is as follows. Code was originally given to me and but I don't know who.

function tac_redirect_to_frontpage() {
	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 )
		bp_core_redirect( $path . $bp->bp_options_nav['groups']['frontpage']['slug'] . '/' );
}
add_action( 'wp', 'tac_redirect_to_frontpage' );

Change History (6)

#1 @boonebgorges
12 years ago

  • Keywords changed from 1.5 plug in redirect,help to 1.5 plug in redirect help

1) Hook earlier.

add_action( 'wp', 'tac_redirect_to_frontpage', 1 );

2) bp_options_nav group items are no longer keyed as 'groups'. Try:

if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['slug'] ) === false )
		bp_core_redirect( $path . $bp->bp_options_nav[$bp->groups->current_group->slug]['frontpage']['slug'] . '/' );

See http://bpdevel.wordpress.com/2011/09/05/manually-modifying-single-group-navigation-in-bp-1-5/ for more details on the change.

Please direct these kinds of questions to the BP support forums or to the development blog. This Trac installation is for discussion of BP bugs and feature enhancements only. Thanks!

#3 @boonebgorges
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Heh. Good call, sbrajesh. I'd missed that. TimCarey, definitely use that constant instead.

#4 @TimCarey
12 years ago

I'm trying to make a new question on the Dev blog but for understanding wise I am replying here. tried the above changes without changing priority and of course it didn't work. When I changed priority like above when I try to go to a group the page loads forever until I get an error from my browser that page cannot be loaded.

#5 @TimCarey
12 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I'm trying to make a new question on the Dev blog but for understanding wise I am replying here. tried the above changes without changing priority and of course it didn't work. When I changed priority like above when I try to go to a group the page loads forever until I get an error from my browser that page cannot be loaded.

#6 @boonebgorges
12 years ago

  • Keywords 1.5 plug in redirect help removed
  • Resolution set to invalid
  • Status changed from reopened to closed

This is not a BuddyPress bug or feature enhancement, so there's no reason to leave the ticket open.

I'm not sure why you're having problems. Probably there is a redirect loop. I have not tested it.

But - it doesn't matter, because, as sbrajesh points out, there is now a built-in way to set a group's default content. Either define BP_GROUPS_DEFAULT_EXTENSION, or filter 'bp_groups_default_extension' in a plugin.

Note: See TracTickets for help on using tickets.