Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_groups_default_extension

  • @timcarey

    Participant

    I can’t find anywhere they act each explains how to use bp_groups_default_extension. Can you explain how to use it in a filter or where to define it

Viewing 5 replies - 1 through 5 (of 5 total)
  • @boonebgorges

    Keymaster

    It works like any other definable constant in BuddyPress, or any other filterable value. Do one of the following:

    1) In wp-config.php or bp-custom.php,
    `define( ‘BP_GROUPS_DEFAULT_EXTENSION’, ‘forum’ );`

    2) In a plugin file or bp-custom.php,
    `function bbg_set_group_default_extension( $ext ) {
    return ‘forum’;
    }
    add_filter( ‘bp_groups_default_extension’, ‘bbg_set_group_default_extension’ );`

    @djpaul

    Keymaster

    I’d like to point out this in currently only in BuddyPress trunk; it won’t get into a release until BP 1.6 (or maybe 1.5.2, or something like that).

    @timcarey

    Participant

    OK. Plus how would that work for a plug in. I’m trying to redirect to a certain tab on the group. Using the plug in.
    I wouldn’t want to have the users of my plug in and go into their config to set up to have my plug in work correctly. This plug in is called BP Group frontpage because it comes up in front or as the first tab

    @timcarey

    Participant

    Before buddy press 1.5 I was using the following function with success.
    `

    function tac_redirect_to_frontpage() {
    global $bp;

    $path = clean_url( $_SERVER );

    $path = apply_filters( ‘bp_uri’, $path );

    if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav ) === false )
    bp_core_redirect( $path . $bp->bp_options_nav . ‘/’ );
    }
    add_action( ‘wp’, ‘tac_redirect_to_frontpage’ );
    `
    I really don’t know exactly what it was doing, but With buddy press 1.5 it stopped working.

    `
    function tac_redirect_to_frontpage() {
    global $bp;

    $path = clean_url( $_SERVER );

    $path = apply_filters( ‘bp_uri’, $path );

    if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav[$bp->groups->current_group->slug] ) === false )
    bp_core_redirect( $path . $bp->bp_options_nav[$bp->groups->current_group->slug] . ‘/’ );
    }
    add_action( ‘wp’, ‘tac_redirect_to_frontpage’,1 );
    `
    All this does is cause the browser to keep loading until it decides there is no page. I’d tried echoing the path variable up above in to the group header and it showed correctly I’d tried echoing the following and it showed nothing.

    `
    $bp->bp_options_nav[$bp->groups->current_group->slug] )
    `

    I could really use any help. @djpaul, or any one

    @timcarey

    Participant

    I narrowed down the problem and but I’m not sure why it is a problem or why my solution works or if my solution is even a good one. Please advise.

    The following is the problem in the problem code above
    `
    bp_core_redirect( $path . *$bp->bp_options_nav[$bp->groups->current_group->slug]. ‘/’ );
    `

    And the following is how I fixed it. Is the following something that is bad that I did? And also is there something wrong with how the above function works bp_core_redirect.
    `
    bp_core_redirect( $path . ‘frontpage’ . ‘/’ );
    `

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘bp_groups_default_extension’ is closed to new replies.
Skip to toolbar