Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: phpbb3 -> bbpress converter

fix post position

function fix_post_position() {
global $bbdb;
$get_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics ORDER BY topic_start_time ASC");
foreach( $get_topics as $get_topic ) {
$get_posttopic = $get_topic->topic_id;
$postorder = 1;
$get_posts = $bbdb->get_results("SELECT * FROM $bbdb->posts WHERE topic_id = '$get_posttopic' AND post_position = '1' ORDER BY post_time ASC");
foreach( $get_posts as $get_post ) {
echo "UPDATE bb_posts SET post_position = ";
echo $postorder++;
echo " WHERE topic_id = ";
echo $get_post->topic_id;
echo " AND post_id = ";
echo $get_post->post_id;
echo " ;";
echo '<br/>';
}
} }

echo fix_post_position in your template file and copy the sql query to your database

Skip to toolbar