Plugin Directory

Changeset 424139


Ignore:
Timestamp:
08/16/2011 10:24:28 AM (14 years ago)
Author:
Orson Teodoro
Message:

make reply properly have a guid and classified as reply after failed linking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • forumconverter/branches/1.08/PhpbbToBbpress.php

    r424137 r424139  
    10761076                        $srctopic = $fdb->get_row('SELECT * FROM '.$this->forumLoginSrc->prefix.'topics WHERE topic_id='.$post->phpbb_topic_id);
    10771077                        if ($srctopic === NULL)
    1078                             $this->fc_echo('error in topic search skipping linking for this reply<br/>');
     1078                            $this->fc_echo('Error in topic search skipping linking for this reply<br/>');
    10791079                        else
    10801080                        {
     
    10841084                                $this->fc_die('failed to locate post'.$wpdb->last_error);
    10851085
    1086                             //force it as reply
    10871086                            //link replies to topic
    10881087                            $status = $wpdb->update($wpdb->prefix.'posts',
    1089                                 array('post_parent' => $dsttopic->wp_id,
    1090                                       'post_type' => 'reply'),
     1088                                array('post_parent' => $dsttopic->wp_id),
    10911089                                array('ID' => $post->wp_id),
    1092                                 array('%d','%s'),
     1090                                array('%d'),
    10931091                                array('%d')
    10941092                            );                         
     
    10961094                                $this->fc_die('failed to link reply to topic'.$wpdb->last_error);
    10971095
    1098                             //correct location
    1099                             $name = $wpdb->get_var('SELECT post_name FROM '.$wpdb->prefix.'posts WHERE ID='.$post->wp_id);
    1100                             $status = $wpdb->update($wpdb->prefix.'posts',
    1101     //                          array('guid' => $this->siteurl.'/?reply='.$name),
    1102                                 array('guid' => $this->siteurl.'/?p='.$post->wp_id),
    1103                                 array('ID' => $post->wp_id),
    1104                                 array('%s'),
    1105                                 array('%d')
    1106                             );                     
    1107                             if ($status === false)
    1108                                 $this->fc_die('failed to update guid: '.$wpdb->last_error);
    1109 
    1110                             //more meta
    1111                             $status = $wpdb->insert($wpdb->prefix.'postmeta',
    1112                                 array( 'post_id'    => $post->wp_id,
    1113                                        'meta_key'   => '_bbp_forum_id',
    1114                                        'meta_value' => $forum->wp_id
    1115                                 ),
    1116                                 array( '%d',//post_id
    1117                                        '%s',//meta_key
    1118                                        '%s' //meta_value
    1119                                 )
    1120                             );
    1121                             if ($status === false)
    1122                                 $this->fc_die('error inserting _bbp_forum_id'.$wpdb->last_error);
    11231096                            $status = $wpdb->insert($wpdb->prefix.'postmeta',
    11241097                                array( 'post_id'    => $post->wp_id,
     
    11341107                                $this->fc_die('error inserting _bbp_topic_id'.$wpdb->last_error);
    11351108                        }
     1109
     1110                        //force it as reply
     1111                        $status = $wpdb->update($wpdb->prefix.'posts',
     1112                            array('post_type' => 'reply'),
     1113                            array('ID' => $post->wp_id),
     1114                            array('%s'),
     1115                            array('%d')
     1116                        );                         
     1117                        if ($status === false)
     1118                            $this->fc_die('failed to post as reply'.$wpdb->last_error);
     1119
     1120                        //correct location
     1121                        $name = $wpdb->get_var('SELECT post_name FROM '.$wpdb->prefix.'posts WHERE ID='.$post->wp_id);
     1122                        $status = $wpdb->update($wpdb->prefix.'posts',
     1123//                          array('guid' => $this->siteurl.'/?reply='.$name),
     1124                            array('guid' => $this->siteurl.'/?p='.$post->wp_id),
     1125                            array('ID' => $post->wp_id),
     1126                            array('%s'),
     1127                            array('%d')
     1128                        );                     
     1129                        if ($status === false)
     1130                            $this->fc_die('failed to update guid: '.$wpdb->last_error);
     1131
     1132                        //more meta
     1133                        $status = $wpdb->insert($wpdb->prefix.'postmeta',
     1134                            array( 'post_id'    => $post->wp_id,
     1135                                   'meta_key'   => '_bbp_forum_id',
     1136                                   'meta_value' => $forum->wp_id
     1137                            ),
     1138                            array( '%d',//post_id
     1139                                   '%s',//meta_key
     1140                                   '%s' //meta_value
     1141                            )
     1142                        );
     1143                        if ($status === false)
     1144                            $this->fc_die('error inserting _bbp_forum_id'.$wpdb->last_error);
    11361145                    }
    11371146
Note: See TracChangeset for help on using the changeset viewer.