admin/mf_custom_group.php
public function delete_custom_group(){
    global $wpdb;

    //checking the nonce
    check_admin_referer('delete_custom_group');

    if( isset($_GET['custom_group_id']) ){
      $id = (int)$_GET['custom_group_id'];
      if( is_int($id) ){
        $group = $this->get_group($id);
        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_GROUPS." WHERE id = %d",$id );
        $wpdb->query($sql);

        $sql_fields = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE custom_group_id = %d",$id );
        $wpdb->query($sql_fields);

        //ToDo: poner mensaje de que se borro correctamente
        $this->mf_redirect('mf_custom_fields','fields_list',array('message' => 'success','post_type' => $group['post_type']));

      }
    }
  }
public function delete_custom_group(){
    global $wpdb;

    //checking the nonce
    check_admin_referer('delete_custom_group');

    if( isset($_GET['custom_group_id']) ){
      $id = (int)$_GET['custom_group_id'];
      if( is_int($id) ){
        $group = $this->get_group($id);
        $sql = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_GROUPS." WHERE id = %d",$id );
        $wpdb->query($sql);

        $sql_fields = $wpdb->prepare( "DELETE FROM ".MF_TABLE_CUSTOM_FIELDS." WHERE custom_group_id = %d",$id );
        $wpdb->query($sql_fields);

        //ToDo: poner mensaje de que se borro correctamente
        $this->mf_redirect('mf_custom_fields','fields_list',array('message' => 'success','post_type' => $group['post_type']));

      }
    }
  }
public function delete_custom_group ( ) { global $ wpdb ; //checking the nonce check_admin_referer ( 'delete_custom_group' ) ; if ( isset ( $ _GET [ 'custom_group_id' ] ) ) { $ id = ( int ) $ _GET [ 'custom_group_id' ] ; if ( is_int ( $ id ) ) { $ group = $ this -> get_group ( $ id ) ; $ sql = $ wpdb -> prepare ( "DELETE FROM " . MF_TABLE_CUSTOM_GROUPS . " WHERE id = %d" , $ id ) ; $ wpdb -> query ( $ sql ) ; $ sql_fields = $ wpdb -> prepare ( "DELETE FROM " . MF_TABLE_CUSTOM_FIELDS . " WHERE custom_group_id = %d" , $ id ) ; $ wpdb -> query ( $ sql_fields ) ; //ToDo: poner mensaje de que se borro correctamente $ this -> mf_redirect ( 'mf_custom_fields' , 'fields_list' , array ( 'message' => 'success' , 'post_type' => $ group [ 'post_type' ] ) ) ; } } }
Delete a custom group
Delete a custom group