| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* bbPress Vanilla Converter |
| 5 |
* |
| 6 |
* @package bbPress |
| 7 |
* @subpackage Converters |
| 8 |
*/ |
| 9 |
|
| 10 |
/** |
| 11 |
* Implementation of Vanilla 2.0.18.1 Converter |
| 12 |
* |
| 13 |
* @since 2.3.0 bbPress (r4717) |
| 14 |
* |
| 15 |
* @link Codex Docs https://codex.bbpress.org/import-forums/vanilla |
| 16 |
*/ |
| 17 |
class Vanilla extends BBP_Converter_Base { |
| 18 |
|
| 19 |
/** |
| 20 |
* Sets up the field mappings |
| 21 |
*/ |
| 22 |
public function setup_globals() { |
| 23 |
|
| 24 |
// Setup smiley URL & path |
| 25 |
$this->bbcode_parser_properties = array( |
| 26 |
'smiley_url' => false, |
| 27 |
'smiley_dir' => false |
| 28 |
); |
| 29 |
|
| 30 |
/** Forum Section *****************************************************/ |
| 31 |
|
| 32 |
// Old forum id (Stored in postmeta) |
| 33 |
$this->field_map[] = array( |
| 34 |
'from_tablename' => 'Category', |
| 35 |
'from_fieldname' => 'CategoryID', |
| 36 |
'from_expression' => 'WHERE Category.CategoryID > 0', |
| 37 |
'to_type' => 'forum', |
| 38 |
'to_fieldname' => '_bbp_old_forum_id' |
| 39 |
); |
| 40 |
|
| 41 |
// Forum parent id (If no parent, then 0. Stored in postmeta) |
| 42 |
$this->field_map[] = array( |
| 43 |
'from_tablename' => 'Category', |
| 44 |
'from_fieldname' => 'ParentCategoryID', |
| 45 |
'to_type' => 'forum', |
| 46 |
'to_fieldname' => '_bbp_old_forum_parent_id', |
| 47 |
'callback_method' => 'callback_forum_parent' |
| 48 |
); |
| 49 |
|
| 50 |
// Forum topic count (Stored in postmeta) |
| 51 |
$this->field_map[] = array( |
| 52 |
'from_tablename' => 'Category', |
| 53 |
'from_fieldname' => 'CountDiscussions', |
| 54 |
'to_type' => 'forum', |
| 55 |
'to_fieldname' => '_bbp_topic_count' |
| 56 |
); |
| 57 |
|
| 58 |
// Forum reply count (Stored in postmeta) |
| 59 |
$this->field_map[] = array( |
| 60 |
'from_tablename' => 'Category', |
| 61 |
'from_fieldname' => 'CountComments', |
| 62 |
'to_type' => 'forum', |
| 63 |
'to_fieldname' => '_bbp_reply_count' |
| 64 |
); |
| 65 |
|
| 66 |
// Forum total topic count (Stored in postmeta) |
| 67 |
$this->field_map[] = array( |
| 68 |
'from_tablename' => 'Category', |
| 69 |
'from_fieldname' => 'CountDiscussions', |
| 70 |
'to_type' => 'forum', |
| 71 |
'to_fieldname' => '_bbp_total_topic_count' |
| 72 |
); |
| 73 |
|
| 74 |
// Forum total reply count (Stored in postmeta) |
| 75 |
$this->field_map[] = array( |
| 76 |
'from_tablename' => 'Category', |
| 77 |
'from_fieldname' => 'CountComments', |
| 78 |
'to_type' => 'forum', |
| 79 |
'to_fieldname' => '_bbp_total_reply_count' |
| 80 |
); |
| 81 |
|
| 82 |
// Forum title. |
| 83 |
$this->field_map[] = array( |
| 84 |
'from_tablename' => 'Category', |
| 85 |
'from_fieldname' => 'Name', |
| 86 |
'to_type' => 'forum', |
| 87 |
'to_fieldname' => 'post_title' |
| 88 |
); |
| 89 |
|
| 90 |
// Forum slug (Clean name to avoid conflicts) |
| 91 |
$this->field_map[] = array( |
| 92 |
'from_tablename' => 'Category', |
| 93 |
'from_fieldname' => 'Name', |
| 94 |
'to_type' => 'forum', |
| 95 |
'to_fieldname' => 'post_name', |
| 96 |
'callback_method' => 'callback_slug' |
| 97 |
); |
| 98 |
|
| 99 |
// Forum description. |
| 100 |
$this->field_map[] = array( |
| 101 |
'from_tablename' => 'Category', |
| 102 |
'from_fieldname' => 'Description', |
| 103 |
'to_type' => 'forum', |
| 104 |
'to_fieldname' => 'post_content', |
| 105 |
'callback_method' => 'callback_null' |
| 106 |
); |
| 107 |
|
| 108 |
// Forum display order (Starts from 1) |
| 109 |
$this->field_map[] = array( |
| 110 |
'from_tablename' => 'Category', |
| 111 |
'from_fieldname' => 'Sort', |
| 112 |
'to_type' => 'forum', |
| 113 |
'to_fieldname' => 'menu_order' |
| 114 |
); |
| 115 |
|
| 116 |
// Forum type (Set a default value 'forum', Stored in postmeta) |
| 117 |
$this->field_map[] = array( |
| 118 |
'to_type' => 'forum', |
| 119 |
'to_fieldname' => '_bbp_forum_type', |
| 120 |
'default' => 'forum' |
| 121 |
); |
| 122 |
|
| 123 |
// Forum status (Set a default value 'open', Stored in postmeta) |
| 124 |
$this->field_map[] = array( |
| 125 |
'to_type' => 'forum', |
| 126 |
'to_fieldname' => '_bbp_status', |
| 127 |
'default' => 'open' |
| 128 |
); |
| 129 |
|
| 130 |
// Forum dates. |
| 131 |
$this->field_map[] = array( |
| 132 |
'from_tablename' => 'Category', |
| 133 |
'from_fieldname' => 'DateInserted', |
| 134 |
'to_type' => 'forum', |
| 135 |
'to_fieldname' => 'post_date', |
| 136 |
); |
| 137 |
$this->field_map[] = array( |
| 138 |
'from_tablename' => 'Category', |
| 139 |
'from_fieldname' => 'DateInserted', |
| 140 |
'to_type' => 'forum', |
| 141 |
'to_fieldname' => 'post_date_gmt', |
| 142 |
); |
| 143 |
$this->field_map[] = array( |
| 144 |
'from_tablename' => 'Category', |
| 145 |
'from_fieldname' => 'DateUpdated', |
| 146 |
'to_type' => 'forum', |
| 147 |
'to_fieldname' => 'post_modified', |
| 148 |
); |
| 149 |
$this->field_map[] = array( |
| 150 |
'from_tablename' => 'Category', |
| 151 |
'from_fieldname' => 'DateUpdated', |
| 152 |
'to_type' => 'forum', |
| 153 |
'to_fieldname' => 'post_modified_gmt', |
| 154 |
); |
| 155 |
|
| 156 |
/** Topic Section *****************************************************/ |
| 157 |
|
| 158 |
// Old topic id (Stored in postmeta) |
| 159 |
// Don't import Vanilla 2's deleted topics |
| 160 |
$this->field_map[] = array( |
| 161 |
'from_tablename' => 'Discussion', |
| 162 |
'from_fieldname' => 'DiscussionID', |
| 163 |
'from_expression' => 'WHERE Format != "Deleted"', |
| 164 |
'to_type' => 'topic', |
| 165 |
'to_fieldname' => '_bbp_old_topic_id' |
| 166 |
); |
| 167 |
|
| 168 |
// Topic reply count (Stored in postmeta) |
| 169 |
$this->field_map[] = array( |
| 170 |
'from_tablename' => 'Discussion', |
| 171 |
'from_fieldname' => 'CountComments', |
| 172 |
'to_type' => 'topic', |
| 173 |
'to_fieldname' => '_bbp_reply_count', |
| 174 |
'callback_method' => 'callback_topic_reply_count' |
| 175 |
); |
| 176 |
|
| 177 |
// Topic total reply count (Includes unpublished replies, Stored in postmeta) |
| 178 |
$this->field_map[] = array( |
| 179 |
'from_tablename' => 'Discussion', |
| 180 |
'from_fieldname' => 'CountComments', |
| 181 |
'to_type' => 'topic', |
| 182 |
'to_fieldname' => '_bbp_total_reply_count', |
| 183 |
'callback_method' => 'callback_topic_reply_count' |
| 184 |
); |
| 185 |
|
| 186 |
// Topic parent forum id (If no parent, then 0. Stored in postmeta) |
| 187 |
$this->field_map[] = array( |
| 188 |
'from_tablename' => 'Discussion', |
| 189 |
'from_fieldname' => 'CategoryID', |
| 190 |
'to_type' => 'topic', |
| 191 |
'to_fieldname' => '_bbp_forum_id', |
| 192 |
'callback_method' => 'callback_forumid' |
| 193 |
); |
| 194 |
|
| 195 |
// Topic author. |
| 196 |
$this->field_map[] = array( |
| 197 |
'from_tablename' => 'Discussion', |
| 198 |
'from_fieldname' => 'InsertUserID', |
| 199 |
'to_type' => 'topic', |
| 200 |
'to_fieldname' => 'post_author', |
| 201 |
'callback_method' => 'callback_userid' |
| 202 |
); |
| 203 |
|
| 204 |
// Topic author name (Stored in postmeta as _bbp_anonymous_name) |
| 205 |
$this->field_map[] = array( |
| 206 |
'to_type' => 'topic', |
| 207 |
'to_fieldname' => '_bbp_old_topic_author_name_id', |
| 208 |
'default' => 'Anonymous' |
| 209 |
); |
| 210 |
|
| 211 |
// Is the topic anonymous (Stored in postmeta) |
| 212 |
$this->field_map[] = array( |
| 213 |
'from_tablename' => 'Discussion', |
| 214 |
'from_fieldname' => 'InsertUserID', |
| 215 |
'to_type' => 'topic', |
| 216 |
'to_fieldname' => '_bbp_old_is_topic_anonymous_id', |
| 217 |
'callback_method' => 'callback_check_anonymous' |
| 218 |
); |
| 219 |
|
| 220 |
// Topic title. |
| 221 |
$this->field_map[] = array( |
| 222 |
'from_tablename' => 'Discussion', |
| 223 |
'from_fieldname' => 'Name', |
| 224 |
'to_type' => 'topic', |
| 225 |
'to_fieldname' => 'post_title' |
| 226 |
); |
| 227 |
|
| 228 |
// Topic slug (Clean name to avoid conflicts) |
| 229 |
$this->field_map[] = array( |
| 230 |
'from_tablename' => 'Discussion', |
| 231 |
'from_fieldname' => 'Name', |
| 232 |
'to_type' => 'topic', |
| 233 |
'to_fieldname' => 'post_name', |
| 234 |
'callback_method' => 'callback_slug' |
| 235 |
); |
| 236 |
|
| 237 |
// Topic content. |
| 238 |
$this->field_map[] = array( |
| 239 |
'from_tablename' => 'Discussion', |
| 240 |
'from_fieldname' => 'Body', |
| 241 |
'to_type' => 'topic', |
| 242 |
'to_fieldname' => 'post_content', |
| 243 |
'callback_method' => 'callback_html' |
| 244 |
); |
| 245 |
|
| 246 |
// Topic status (Open or Closed) |
| 247 |
$this->field_map[] = array( |
| 248 |
'from_tablename' => 'Discussion', |
| 249 |
'from_fieldname' => 'closed', |
| 250 |
'to_type' => 'topic', |
| 251 |
'to_fieldname' => '_bbp_old_closed_status_id', |
| 252 |
'callback_method' => 'callback_topic_status' |
| 253 |
); |
| 254 |
|
| 255 |
// Topic author ip (Stored in postmeta) |
| 256 |
$this->field_map[] = array( |
| 257 |
'from_tablename' => 'Discussion', |
| 258 |
'from_fieldname' => 'InsertIPAddress', |
| 259 |
'to_type' => 'topic', |
| 260 |
'to_fieldname' => '_bbp_author_ip' |
| 261 |
); |
| 262 |
|
| 263 |
// Topic parent forum id (If no parent, then 0) |
| 264 |
$this->field_map[] = array( |
| 265 |
'from_tablename' => 'Discussion', |
| 266 |
'from_fieldname' => 'CategoryID', |
| 267 |
'to_type' => 'topic', |
| 268 |
'to_fieldname' => 'post_parent', |
| 269 |
'callback_method' => 'callback_forumid' |
| 270 |
); |
| 271 |
|
| 272 |
// Sticky status (Stored in postmeta) |
| 273 |
$this->field_map[] = array( |
| 274 |
'from_tablename' => 'Discussion', |
| 275 |
'from_fieldname' => 'Announce', |
| 276 |
'to_type' => 'topic', |
| 277 |
'to_fieldname' => '_bbp_old_sticky_status_id', |
| 278 |
'callback_method' => 'callback_sticky_status' |
| 279 |
); |
| 280 |
|
| 281 |
// Topic dates. |
| 282 |
$this->field_map[] = array( |
| 283 |
'from_tablename' => 'Discussion', |
| 284 |
'from_fieldname' => 'DateInserted', |
| 285 |
'to_type' => 'topic', |
| 286 |
'to_fieldname' => 'post_date' |
| 287 |
); |
| 288 |
$this->field_map[] = array( |
| 289 |
'from_tablename' => 'Discussion', |
| 290 |
'from_fieldname' => 'DateInserted', |
| 291 |
'to_type' => 'topic', |
| 292 |
'to_fieldname' => 'post_date_gmt' |
| 293 |
); |
| 294 |
$this->field_map[] = array( |
| 295 |
'from_tablename' => 'Discussion', |
| 296 |
'from_fieldname' => 'DateUpdated', |
| 297 |
'to_type' => 'topic', |
| 298 |
'to_fieldname' => 'post_modified' |
| 299 |
); |
| 300 |
$this->field_map[] = array( |
| 301 |
'from_tablename' => 'Discussion', |
| 302 |
'from_fieldname' => 'DateUpdated', |
| 303 |
'to_type' => 'topic', |
| 304 |
'to_fieldname' => 'post_modified_gmt' |
| 305 |
); |
| 306 |
$this->field_map[] = array( |
| 307 |
'from_tablename' => 'Discussion', |
| 308 |
'from_fieldname' => 'DateLastComment', |
| 309 |
'to_type' => 'topic', |
| 310 |
'to_fieldname' => '_bbp_last_active_time' |
| 311 |
); |
| 312 |
|
| 313 |
/** Tags Section ******************************************************/ |
| 314 |
|
| 315 |
// Topic id. |
| 316 |
$this->field_map[] = array( |
| 317 |
'from_tablename' => 'TagDiscussion', |
| 318 |
'from_fieldname' => 'DiscussionID', |
| 319 |
'to_type' => 'tags', |
| 320 |
'to_fieldname' => 'objectid', |
| 321 |
'callback_method' => 'callback_topicid' |
| 322 |
); |
| 323 |
|
| 324 |
// Taxonomy ID. |
| 325 |
$this->field_map[] = array( |
| 326 |
'from_tablename' => 'TagDiscussion', |
| 327 |
'from_fieldname' => 'TagID', |
| 328 |
'to_type' => 'tags', |
| 329 |
'to_fieldname' => 'taxonomy' |
| 330 |
); |
| 331 |
|
| 332 |
// Term text. |
| 333 |
$this->field_map[] = array( |
| 334 |
'from_tablename' => 'Tag', |
| 335 |
'from_fieldname' => 'Name', |
| 336 |
'join_tablename' => 'TagDiscussion', |
| 337 |
'join_type' => 'INNER', |
| 338 |
'join_expression' => 'USING (tagid)', |
| 339 |
'to_type' => 'tags', |
| 340 |
'to_fieldname' => 'name' |
| 341 |
); |
| 342 |
|
| 343 |
/** Reply Section *****************************************************/ |
| 344 |
|
| 345 |
// Old reply id (Stored in postmeta) |
| 346 |
// Don't import Vanilla 2's deleted replies |
| 347 |
$this->field_map[] = array( |
| 348 |
'from_tablename' => 'Comment', |
| 349 |
'from_fieldname' => 'CommentID', |
| 350 |
'from_expression' => 'WHERE Format != "Deleted"', |
| 351 |
'to_type' => 'reply', |
| 352 |
'to_fieldname' => '_bbp_old_reply_id' |
| 353 |
); |
| 354 |
|
| 355 |
// Reply parent topic id (If no parent, then 0. Stored in postmeta) |
| 356 |
$this->field_map[] = array( |
| 357 |
'from_tablename' => 'Comment', |
| 358 |
'from_fieldname' => 'DiscussionID', |
| 359 |
'to_type' => 'reply', |
| 360 |
'to_fieldname' => '_bbp_topic_id', |
| 361 |
'callback_method' => 'callback_topicid' |
| 362 |
); |
| 363 |
|
| 364 |
// Reply parent forum id (If no parent, then 0. Stored in postmeta) |
| 365 |
$this->field_map[] = array( |
| 366 |
'from_tablename' => 'Comment', |
| 367 |
'from_fieldname' => 'DiscussionID', |
| 368 |
'to_type' => 'reply', |
| 369 |
'to_fieldname' => '_bbp_forum_id', |
| 370 |
'callback_method' => 'callback_topicid_to_forumid' |
| 371 |
); |
| 372 |
|
| 373 |
// Reply author ip (Stored in postmeta) |
| 374 |
$this->field_map[] = array( |
| 375 |
'from_tablename' => 'Comment', |
| 376 |
'from_fieldname' => 'InsertIPAddress', |
| 377 |
'to_type' => 'reply', |
| 378 |
'to_fieldname' => '_bbp_author_ip' |
| 379 |
); |
| 380 |
|
| 381 |
// Reply author. |
| 382 |
$this->field_map[] = array( |
| 383 |
'from_tablename' => 'Comment', |
| 384 |
'from_fieldname' => 'InsertUserID', |
| 385 |
'to_type' => 'reply', |
| 386 |
'to_fieldname' => 'post_author', |
| 387 |
'callback_method' => 'callback_userid' |
| 388 |
); |
| 389 |
|
| 390 |
// Reply author name (Stored in postmeta as _bbp_anonymous_name) |
| 391 |
$this->field_map[] = array( |
| 392 |
'to_type' => 'reply', |
| 393 |
'to_fieldname' => '_bbp_old_reply_author_name_id', |
| 394 |
'default' => 'Anonymous' |
| 395 |
); |
| 396 |
|
| 397 |
// Is the reply anonymous (Stored in postmeta) |
| 398 |
$this->field_map[] = array( |
| 399 |
'from_tablename' => 'Comment', |
| 400 |
'from_fieldname' => 'InsertUserID', |
| 401 |
'to_type' => 'reply', |
| 402 |
'to_fieldname' => '_bbp_old_is_reply_anonymous_id', |
| 403 |
'callback_method' => 'callback_check_anonymous' |
| 404 |
); |
| 405 |
|
| 406 |
// Reply content. |
| 407 |
$this->field_map[] = array( |
| 408 |
'from_tablename' => 'Comment', |
| 409 |
'from_fieldname' => 'Body', |
| 410 |
'to_type' => 'reply', |
| 411 |
'to_fieldname' => 'post_content', |
| 412 |
'callback_method' => 'callback_html' |
| 413 |
); |
| 414 |
|
| 415 |
// Reply parent topic id (If no parent, then 0) |
| 416 |
$this->field_map[] = array( |
| 417 |
'from_tablename' => 'Comment', |
| 418 |
'from_fieldname' => 'DiscussionID', |
| 419 |
'to_type' => 'reply', |
| 420 |
'to_fieldname' => 'post_parent', |
| 421 |
'callback_method' => 'callback_topicid' |
| 422 |
); |
| 423 |
|
| 424 |
// Reply dates. |
| 425 |
$this->field_map[] = array( |
| 426 |
'from_tablename' => 'Comment', |
| 427 |
'from_fieldname' => 'DateInserted', |
| 428 |
'to_type' => 'reply', |
| 429 |
'to_fieldname' => 'post_date' |
| 430 |
); |
| 431 |
$this->field_map[] = array( |
| 432 |
'from_tablename' => 'Comment', |
| 433 |
'from_fieldname' => 'DateInserted', |
| 434 |
'to_type' => 'reply', |
| 435 |
'to_fieldname' => 'post_date_gmt' |
| 436 |
); |
| 437 |
$this->field_map[] = array( |
| 438 |
'from_tablename' => 'Comment', |
| 439 |
'from_fieldname' => 'DateUpdated', |
| 440 |
'to_type' => 'reply', |
| 441 |
'to_fieldname' => 'post_modified' |
| 442 |
); |
| 443 |
$this->field_map[] = array( |
| 444 |
'from_tablename' => 'Comment', |
| 445 |
'from_fieldname' => 'DateUpdated', |
| 446 |
'to_type' => 'reply', |
| 447 |
'to_fieldname' => 'post_modified_gmt' |
| 448 |
); |
| 449 |
|
| 450 |
/** User Section ******************************************************/ |
| 451 |
|
| 452 |
// Store old user id (Stored in usermeta) |
| 453 |
// Don't import user Vanilla's deleted users |
| 454 |
$this->field_map[] = array( |
| 455 |
'from_tablename' => 'User', |
| 456 |
'from_fieldname' => 'UserID', |
| 457 |
'from_expression' => 'WHERE Deleted !=1', |
| 458 |
'to_type' => 'user', |
| 459 |
'to_fieldname' => '_bbp_old_user_id' |
| 460 |
); |
| 461 |
|
| 462 |
// Store old user password (Stored in usermeta) |
| 463 |
$this->field_map[] = array( |
| 464 |
'from_tablename' => 'User', |
| 465 |
'from_fieldname' => 'Password', |
| 466 |
'to_type' => 'user', |
| 467 |
'to_fieldname' => '_bbp_password' |
| 468 |
); |
| 469 |
|
| 470 |
// User name. |
| 471 |
$this->field_map[] = array( |
| 472 |
'from_tablename' => 'User', |
| 473 |
'from_fieldname' => 'Name', |
| 474 |
'to_type' => 'user', |
| 475 |
'to_fieldname' => 'user_login' |
| 476 |
); |
| 477 |
|
| 478 |
// User nice name. |
| 479 |
$this->field_map[] = array( |
| 480 |
'from_tablename' => 'User', |
| 481 |
'from_fieldname' => 'Name', |
| 482 |
'to_type' => 'user', |
| 483 |
'to_fieldname' => 'user_nicename' |
| 484 |
); |
| 485 |
|
| 486 |
// User email. |
| 487 |
$this->field_map[] = array( |
| 488 |
'from_tablename' => 'User', |
| 489 |
'from_fieldname' => 'Email', |
| 490 |
'to_type' => 'user', |
| 491 |
'to_fieldname' => 'user_email' |
| 492 |
); |
| 493 |
|
| 494 |
// User registered. |
| 495 |
$this->field_map[] = array( |
| 496 |
'from_tablename' => 'User', |
| 497 |
'from_fieldname' => 'DateInserted', |
| 498 |
'to_type' => 'user', |
| 499 |
'to_fieldname' => 'user_registered' |
| 500 |
); |
| 501 |
|
| 502 |
// Display Name |
| 503 |
$this->field_map[] = array( |
| 504 |
'from_tablename' => 'User', |
| 505 |
'from_fieldname' => 'Name', |
| 506 |
'to_type' => 'user', |
| 507 |
'to_fieldname' => 'display_name' |
| 508 |
); |
| 509 |
} |
| 510 |
|
| 511 |
/** |
| 512 |
* This method allows us to indicates what is or is not converted for each |
| 513 |
* converter. |
| 514 |
*/ |
| 515 |
public function info() { |
| 516 |
return ''; |
| 517 |
} |
| 518 |
|
| 519 |
/** |
| 520 |
* Translate the topic status from Vanilla v2.x numerics to WordPress's strings. |
| 521 |
* |
| 522 |
* @param int $status Vanilla v2.x numeric topic status |
| 523 |
* @return string WordPress safe |
| 524 |
*/ |
| 525 |
public function callback_topic_status( $status = 0 ) { |
| 526 |
switch ( $status ) { |
| 527 |
case 1 : |
| 528 |
$status = 'closed'; |
| 529 |
break; |
| 530 |
|
| 531 |
case 0 : |
| 532 |
default : |
| 533 |
$status = 'publish'; |
| 534 |
break; |
| 535 |
} |
| 536 |
return $status; |
| 537 |
} |
| 538 |
|
| 539 |
/** |
| 540 |
* Translate the topic sticky status type from Vanilla v2.x numerics to WordPress's strings. |
| 541 |
* |
| 542 |
* @param int $status Vanilla v2.x numeric forum type |
| 543 |
* @return string WordPress safe |
| 544 |
*/ |
| 545 |
public function callback_sticky_status( $status = 0 ) { |
| 546 |
switch ( $status ) { |
| 547 |
case 1 : |
| 548 |
$status = 'sticky'; // Vanilla Sticky 'Announce = 1' |
| 549 |
break; |
| 550 |
|
| 551 |
case 0 : |
| 552 |
default : |
| 553 |
$status = 'normal'; // Vanilla normal topic 'Announce = 0' |
| 554 |
break; |
| 555 |
} |
| 556 |
return $status; |
| 557 |
} |
| 558 |
|
| 559 |
/** |
| 560 |
* Clean Root Parent ID -1 to 0 |
| 561 |
* |
| 562 |
* @param int $parent_id Vanilla v2.x Parent ID |
| 563 |
* @return int |
| 564 |
*/ |
| 565 |
public function callback_forum_parent( $parent_id = 0 ) { |
| 566 |
if ( -1 === (int) $parent_id ) { |
| 567 |
return 0; |
| 568 |
} else { |
| 569 |
return $parent_id; |
| 570 |
} |
| 571 |
} |
| 572 |
|
| 573 |
/** |
| 574 |
* Verify the topic reply count. |
| 575 |
* |
| 576 |
* @param int $count Vanilla v2.x reply count |
| 577 |
* @return string WordPress safe |
| 578 |
*/ |
| 579 |
public function callback_topic_reply_count( $count = 1 ) { |
| 580 |
$count = absint( (int) $count - 1 ); |
| 581 |
return $count; |
| 582 |
} |
| 583 |
|
| 584 |
/** |
| 585 |
* This method is to save the salt and password together. That |
| 586 |
* way when we authenticate it we can get it out of the database |
| 587 |
* as one value. Array values are auto sanitized by WordPress. |
| 588 |
*/ |
| 589 |
public function callback_savepass( $field, $row ) { |
| 590 |
return false; |
| 591 |
} |
| 592 |
|
| 593 |
/** |
| 594 |
* This method is to take the pass out of the database and compare |
| 595 |
* to a pass the user has typed in. |
| 596 |
*/ |
| 597 |
public function authenticate_pass( $password, $serialized_pass ) { |
| 598 |
return false; |
| 599 |
} |
| 600 |
} |
| 601 |
|