[Bb-trac] [bbPress] #736: new_topic should be usable from topic view

bbPress bb-trac at lists.bbpress.org
Thu Aug 30 05:15:11 GMT 2007


#736: new_topic should be usable from topic view
-------------------------+--------------------------------------------------
 Reporter:  baptiste     |       Owner:     
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:     
Component:  Front-end    |     Version:     
 Severity:  normal       |    Keywords:     
-------------------------+--------------------------------------------------
 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.

-- 
Ticket URL: <http://trac.bbpress.org/ticket/736>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list