Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_forum_permalink() is missing a ‘/’

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Sounds like it might be a bug. Could you open a ticket at http://trac.buddypress.org? Use the same credentials you use on this site.

    Avatar of Lawrence
    Lawrence
    Participant

    @grimbog

    Submitted this as a ticket, and attached proposed fix.

    Essentially, the permalink wasnt forming properly as it was missing a forward slash before ‘forum’ on line 1326 of bp-forum-template.php. Also trailingslashit(); was being run twice, which causes two forward-slashes.

    My fix is below…

    function bp_forum_permalink( $forum_id = 0 ) {
    echo bp_get_forum_permalink( $forum_id );
    }
    function bp_get_forum_permalink( $forum_id = 0 ) {
    global $bp;

    if ( bp_is_groups_component() ) {
    $permalink = trailingslashit( bp_get_root_domain() . ‘/’ . bp_get_groups_root_slug() . ‘/’ . bp_current_item() . ‘/’ . ‘forum’ );
    } else {
    if ( empty( $forum_id ) ) {
    global $topic_template;
    if ( isset( $topic_template->forum_id ) )
    $forum_id = $topic_template->forum_id;
    }

    if ( $forum = bp_forums_get_forum( $forum_id ) )
    $permalink = trailingslashit( bp_get_root_domain() . ‘/’ . bp_get_forums_root_slug() . ‘/forum/’ . $forum->forum_slug );
    else
    return false;
    }

    return apply_filters( ‘bp_get_forum_permalink’, $permalink );
    }

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.