Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add close topic button/link

  • @chronicbubble

    Participant

    Hi,

    How can I go about adding a close topic button/link within the topic itself for the original poster to have the option to close it please?,top

    I have removed the bottom two drop down options you see!

    Regards,

    Gareth

Viewing 2 replies - 1 through 2 (of 2 total)
  • @chronicbubble

    Participant

    Anyone know at all please?

    @shazdeh

    Participant

    Hi!

    bbP has bbp_get_topic_close_link function (defined in bbpress/includes/topics/template.php file) that outputs an anchor tag (<a>). However customizing the anchor tag proved difficult so we ended up using a bit of custom code to output the link:

    
    	<?php if( is_singular( 'topic' ) && current_user_can( 'moderate' ) ) : ?>
    		<div class="post-note">
    			<?php
    			$topic = bbp_get_topic( bbp_get_topic_id() );
    			if( bbp_is_topic_open( $topic->ID ) ) {
    				$uri     = add_query_arg( array( 'action' => 'bbp_toggle_topic_close', 'topic_id' => $topic->ID ) );
    				$uri     = wp_nonce_url( $uri, 'close-topic_' . $topic->ID );
    				echo '<a href="' . esc_url( $uri ) . '" class="bbp-topic-close-link button green">Close Thread</a>';
    			}
    			?>
    		</div>
    	<?php endif; ?>
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar