Reply To: Help with importing from WBB3.1
Allright, another thing I need help with:
In WBB, there's the field isClosed to create a WordPress status from it with this:
// Topic status (Open or Closed)
$this->field_map[] = array(
'from_tablename' => 'wbb1_1_thread',
'from_fieldname' => 'isClosed',
'to_type' => 'topic',
'to_fieldname' => 'post_status',
'callback_method' => 'callback_topic_status'
);
and
public function callback_topic_status( $status = 0 ) {
switch ( $status ) {
case 1 :
$status = 'closed';
break;
case 0 :
default :
$status = 'publish';
break;
}
return $status;
}
But there’s also a field called “isDeleted”, so I could also use
`// Topic status (Deleted)
$this->field_map[] = array(
‘from_tablename’ => ‘wbb1_1_thread’,
‘from_fieldname’ => ‘isDeleted’,
‘to_type’ => ‘topic’,
‘to_fieldname’ => ‘post_status’,
‘callback_method’ => ‘callback_trash_status’
);`
and
public function callback_trash_status( $status = 1 ) {
switch ( $status ) {
case 1 :
$status = 'trash';
break;
case 0 :
default :
$status = 'publish';
break;
}
return $status;
}
The second, though, would overwrite the first, so that even closed topics that are not trash have the status publish again. Is there any chance to combine these two?