-
-
Save stefanich/4f8f7b436b87287f44bf to your computer and use it in GitHub Desktop.
callback_method for Vanilla import using ReplyTo plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Added to converter.php | |
private function callback_oldid( $field ) { | |
if ( 0 == $field ) { | |
return 0; | |
} else { | |
$row = $this->wpdb->get_row($this->wpdb->prepare('SELECT post_id, meta_value FROM wp_postmeta WHERE meta_key = "_bbp_post_id" AND meta_value = "%s" LIMIT 1', $field)); | |
if( !is_null( $row ) ) { | |
return $row->post_id; | |
} else { | |
return 0; | |
} | |
} | |
} | |
//Added to Vanilla converter file | |
// Make sure it is after the mapping that creates new post | |
$this->field_map[] = array( | |
'from_tablename' => 'Comment', | |
'from_fieldname' => 'ParentCommentID', | |
'to_type' => 'reply', | |
'to_fieldname' => '_bbp_reply_to', | |
'callback_method' => 'callback_oldid' | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment