[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-admin/ -> topic-toggle.php (source)

   1  <?php
   2  require ('admin-action.php');
   3  
   4  $topic_id = (int) $_GET['id'];
   5  $topic    =  get_topic ( $topic_id );
   6  
   7  if ( !$topic )
   8      bb_die(__('There is a problem with that topic, pardner.'));
   9  
  10  if ( !bb_current_user_can( 'close_topic', $topic_id ) ) {
  11      wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
  12      exit;
  13  }
  14  
  15  bb_check_admin_referer( 'close-topic_' . $topic_id );
  16  
  17  if ( topic_is_open( $topic_id ) ) {
  18      bb_close_topic( $topic_id );
  19      $message = 'closed';
  20  } else {
  21      bb_open_topic ( $topic_id );
  22      $message = 'opened';
  23  }
  24  
  25  if ( $sendto = wp_get_referer() ) {
  26      $sendto = remove_query_arg( 'message', $sendto );
  27      $sendto = add_query_arg( 'message', $message, $sendto );
  28  } else {
  29      $sendto = get_topic_link( $topic_id );
  30  }
  31  
  32  bb_safe_redirect( $sendto );
  33  exit;


Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1