Skip to:
Content

Opened 7 years ago

Closed 7 years ago

#736 closed enhancement (fixed)

new_topic should be usable from topic view

Reported by: baptiste Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Front-end Keywords:
Cc:

Description

template function new_topic should be usable while viewing a topic thread. This provides template designers with more flexibility for navigation. The following code updates the new_topic function so it will return a usable link for topic views:

file bb-includes/template-functions.php

function new_topic( $text = false ) {
        if ( !$text )
                $text = __('Add New »');

        if ( is_forum() || is_bb_tag() )
                $url = '#postform';
        elseif ( is_topic() )
                $url = get_forum_link() . '#postform';
        elseif ( is_front() )
                $url = add_query_arg( 'new', '1', bb_get_option( 'uri' ) );
        if ( !bb_is_user_logged_in() )
                $url = add_query_arg( 're', urlencode($url), bb_get_option( 'uri' ) . 'bb-login.php' );
        elseif ( is_forum() || is_topic() ) {
                if ( !bb_current_user_can( 'write_topic', get_forum_id() ) )
                        return;
        } else {
                if ( !bb_current_user_can( 'write_topics' ) )
                        return;
        }

        if ( $url = attribute_escape( apply_filters( 'new_topic_url', $url ) ) )
                echo "<a href='$url' class='new-topic'>$text</a>\n";
}

I just added to two is_topic sections with a proper url population.

Change History (1)

comment:1 mdawaffe7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [925]) more flexible new_topic(). Includes: fixes #736 props baptiste

Note: See TracTickets for help on using tickets.