コード例 #1
0
ファイル: class.php プロジェクト: alvarpoon/anbig
 public function delete_post($id)
 {
     if (d4p_has_bbpress()) {
         if (bbp_is_reply($id) || bbp_is_topic($id)) {
             if ($this->o['delete_attachments'] == 'delete') {
                 $files = d4p_get_post_attachments($id);
                 if (is_array($files) && !empty($files)) {
                     foreach ($files as $file) {
                         wp_delete_attachment($file->ID);
                     }
                 }
             } else {
                 if ($this->o['delete_attachments'] == 'detach') {
                     global $wpdb;
                     $wpdb->update($wpdb->posts, array('post_parent' => 0), array('post_parent' => $id, 'post_type' => 'attachment'));
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: shared.php プロジェクト: alvarpoon/anbig
 /**
  * Check if the current page is forum, topic or other bbPress page.
  *
  * @return bool true if the current page is the forum related
  */
 function d4p_is_bbpress()
 {
     $is = d4p_has_bbpress() ? is_bbpress() : false;
     return apply_filters('d4p_is_bbpress', $is);
 }