[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

   1  <?php
   2  require ('admin-action.php');
   3  
   4  $topic_id = (int) $_GET['id'];
   5  
   6  if ( !bb_current_user_can( 'delete_topic', $topic_id ) ) {
   7      wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
   8      exit;
   9  }
  10  
  11  bb_check_admin_referer( 'delete-topic_' . $topic_id );
  12  
  13  $topic = get_topic( $topic_id );
  14  $old_status = (int) $topic->topic_status;
  15  
  16  if ( !$topic )
  17      bb_die(__('There is a problem with that topic, pardner.'));
  18  
  19  $status = $topic->topic_status ? 0 : 1;
  20  bb_delete_topic( $topic->topic_id, $status );
  21  
  22  $message = '';
  23  switch ( $old_status ) {
  24      case 0:
  25          switch ( $status ) {
  26              case 0:
  27                  break;
  28              case 1:
  29                  $message = 'deleted';
  30                  break;
  31          }
  32          break;
  33      case 1:
  34          switch ( $status ) {
  35              case 0:
  36                  $message = 'undeleted';
  37                  break;
  38              case 1:
  39                  break;
  40          }
  41          break;
  42  }
  43  
  44  if ( $sendto = wp_get_referer() ) {
  45      $sendto = remove_query_arg( 'message', $sendto );
  46      $sendto = add_query_arg( 'message', $message, $sendto );
  47  } elseif ( 0 == $topic->topic_status )
  48      $sendto = get_forum_link( $topic->forum_id );
  49  else
  50      $sendto = get_topic_link( $topic_id );
  51      
  52  wp_redirect( $sendto );
  53  exit;


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