[ Index ] |
PHP Cross Reference of BBPress |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * bbPress Kunena 3.x Converter 5 * 6 * @package bbPress 7 * @subpackage Converters 8 */ 9 10 /** 11 * Implementation of Kunena v3.x Forums for Joomla Forum converter. 12 * 13 * @since 2.5.0 bbPress (r5144) 14 * 15 * @link Codex Docs https://codex.bbpress.org/import-forums/kunena/ 16 */ 17 class Kunena3 extends BBP_Converter_Base { 18 19 /** 20 * Main Constructor 21 * 22 */ 23 public function __construct() { 24 parent::__construct(); 25 } 26 27 /** 28 * Sets up the field mappings 29 */ 30 public function setup_globals() { 31 32 /** Forum Section *****************************************************/ 33 34 // Old forum id (Stored in postmeta) 35 $this->field_map[] = array( 36 'from_tablename' => 'kunena_categories', 37 'from_fieldname' => 'id', 38 'to_type' => 'forum', 39 'to_fieldname' => '_bbp_old_forum_id' 40 ); 41 42 // Forum parent id (If no parent, then 0, Stored in postmeta) 43 $this->field_map[] = array( 44 'from_tablename' => 'kunena_categories', 45 'from_fieldname' => 'parent_id', 46 'to_type' => 'forum', 47 'to_fieldname' => '_bbp_old_forum_parent_id' 48 ); 49 50 // Forum topic count (Stored in postmeta) 51 $this->field_map[] = array( 52 'from_tablename' => 'kunena_categories', 53 'from_fieldname' => 'numTopics', 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' => 'kunena_categories', 61 'from_fieldname' => 'numPosts', 62 'to_type' => 'forum', 63 'to_fieldname' => '_bbp_reply_count' 64 ); 65 66 // Forum total topic count (Includes unpublished topics, Stored in postmeta) 67 $this->field_map[] = array( 68 'from_tablename' => 'kunena_categories', 69 'from_fieldname' => 'numTopics', 70 'to_type' => 'forum', 71 'to_fieldname' => '_bbp_total_topic_count' 72 ); 73 74 // Forum total reply count (Includes unpublished replies, Stored in postmeta) 75 $this->field_map[] = array( 76 'from_tablename' => 'kunena_categories', 77 'from_fieldname' => 'numPosts', 78 'to_type' => 'forum', 79 'to_fieldname' => '_bbp_total_reply_count' 80 ); 81 82 // Forum title. 83 $this->field_map[] = array( 84 'from_tablename' => 'kunena_categories', 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' => 'kunena_categories', 93 'from_fieldname' => 'alias', 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' => 'kunena_categories', 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' => 'kunena_categories', 111 'from_fieldname' => 'ordering', 112 'to_type' => 'forum', 113 'to_fieldname' => 'menu_order' 114 ); 115 116 // Forum type (Category = 0 or Forum = >0, Stored in postmeta) 117 $this->field_map[] = array( 118 'from_tablename' => 'kunena_categories', 119 'from_fieldname' => 'parent_id', 120 'to_type' => 'forum', 121 'to_fieldname' => '_bbp_forum_type', 122 'callback_method' => 'callback_forum_type' 123 ); 124 125 // Forum status (Open = 0 or Closed = 1, Stored in postmeta) 126 $this->field_map[] = array( 127 'from_tablename' => 'kunena_categories', 128 'from_fieldname' => 'locked', 129 'to_type' => 'forum', 130 'to_fieldname' => '_bbp_status', 131 'callback_method' => 'callback_forum_status' 132 ); 133 134 // Forum dates. 135 $this->field_map[] = array( 136 'to_type' => 'forum', 137 'to_fieldname' => 'post_date', 138 'default' => date('Y-m-d H:i:s') 139 ); 140 $this->field_map[] = array( 141 'to_type' => 'forum', 142 'to_fieldname' => 'post_date_gmt', 143 'default' => date('Y-m-d H:i:s') 144 ); 145 $this->field_map[] = array( 146 'to_type' => 'forum', 147 'to_fieldname' => 'post_modified', 148 'default' => date('Y-m-d H:i:s') 149 ); 150 $this->field_map[] = array( 151 'to_type' => 'forum', 152 'to_fieldname' => 'post_modified_gmt', 153 'default' => date('Y-m-d H:i:s') 154 ); 155 156 /** Topic Section *****************************************************/ 157 158 // Old topic id (Stored in postmeta) 159 $this->field_map[] = array( 160 'from_tablename' => 'kunena_topics', 161 'from_fieldname' => 'id', 162 'to_type' => 'topic', 163 'to_fieldname' => '_bbp_old_topic_id' 164 ); 165 166 // Topic reply count (Stored in postmeta) 167 $this->field_map[] = array( 168 'from_tablename' => 'kunena_topics', 169 'from_fieldname' => 'posts', 170 'to_type' => 'topic', 171 'to_fieldname' => '_bbp_reply_count', 172 'callback_method' => 'callback_topic_reply_count' 173 ); 174 175 // Topic total reply count (Includes unpublished replies, Stored in postmeta) 176 $this->field_map[] = array( 177 'from_tablename' => 'kunena_topics', 178 'from_fieldname' => 'posts', 179 'to_type' => 'topic', 180 'to_fieldname' => '_bbp_total_reply_count', 181 'callback_method' => 'callback_topic_reply_count' 182 ); 183 184 // Topic parent forum id (If no parent, then 0. Stored in postmeta) 185 $this->field_map[] = array( 186 'from_tablename' => 'kunena_topics', 187 'from_fieldname' => 'category_id', 188 'to_type' => 'topic', 189 'to_fieldname' => '_bbp_forum_id', 190 'callback_method' => 'callback_forumid' 191 ); 192 193 // Topic author. 194 $this->field_map[] = array( 195 'from_tablename' => 'kunena_topics', 196 'from_fieldname' => 'first_post_userid', 197 'to_type' => 'topic', 198 'to_fieldname' => 'post_author', 199 'callback_method' => 'callback_userid' 200 ); 201 202 // Topic Author ip (Stored in postmeta) 203 // Note: We join the 'kunena_messages' table because 'kunena_topics' table does not include author ip. 204 $this->field_map[] = array( 205 'from_tablename' => 'kunena_messages', 206 'from_fieldname' => 'ip', 207 'join_tablename' => 'kunena_topics', 208 'join_type' => 'LEFT', 209 'join_expression' => 'USING (id)', 210 'to_type' => 'topic', 211 'to_fieldname' => '_bbp_author_ip' 212 ); 213 214 // Topic content. 215 $this->field_map[] = array( 216 'from_tablename' => 'kunena_topics', 217 'from_fieldname' => 'first_post_message', 218 'to_type' => 'topic', 219 'to_fieldname' => 'post_content', 220 'callback_method' => 'callback_html' 221 ); 222 223 // Topic title. 224 $this->field_map[] = array( 225 'from_tablename' => 'kunena_topics', 226 'from_fieldname' => 'subject', 227 'to_type' => 'topic', 228 'to_fieldname' => 'post_title' 229 ); 230 231 // Topic slug (Clean name to avoid conflicts) 232 $this->field_map[] = array( 233 'from_tablename' => 'kunena_topics', 234 'from_fieldname' => 'subject', 235 'to_type' => 'topic', 236 'to_fieldname' => 'post_name', 237 'callback_method' => 'callback_slug' 238 ); 239 240 // Topic parent forum id (If no parent, then 0) 241 $this->field_map[] = array( 242 'from_tablename' => 'kunena_topics', 243 'from_fieldname' => 'category_id', 244 'to_type' => 'topic', 245 'to_fieldname' => 'post_parent', 246 'callback_method' => 'callback_forumid' 247 ); 248 249 // Topic dates. 250 $this->field_map[] = array( 251 'from_tablename' => 'kunena_topics', 252 'from_fieldname' => 'first_post_time', 253 'to_type' => 'topic', 254 'to_fieldname' => 'post_date', 255 'callback_method' => 'callback_datetime' 256 ); 257 $this->field_map[] = array( 258 'from_tablename' => 'kunena_topics', 259 'from_fieldname' => 'first_post_time', 260 'to_type' => 'topic', 261 'to_fieldname' => 'post_date_gmt', 262 'callback_method' => 'callback_datetime' 263 ); 264 $this->field_map[] = array( 265 'from_tablename' => 'kunena_topics', 266 'from_fieldname' => 'last_post_time', 267 'to_type' => 'topic', 268 'to_fieldname' => 'post_modified', 269 'callback_method' => 'callback_datetime' 270 ); 271 $this->field_map[] = array( 272 'from_tablename' => 'kunena_topics', 273 'from_fieldname' => 'last_post_time', 274 'to_type' => 'topic', 275 'to_fieldname' => 'post_modified_gmt', 276 'callback_method' => 'callback_datetime' 277 ); 278 $this->field_map[] = array( 279 'from_tablename' => 'kunena_topics', 280 'from_fieldname' => 'last_post_time', 281 'to_type' => 'topic', 282 'to_fieldname' => '_bbp_last_active_time', 283 'callback_method' => 'callback_datetime' 284 ); 285 286 // Topic status (Open or Closed, Kunena v3.x 0=open & 1=closed) 287 $this->field_map[] = array( 288 'from_tablename' => 'kunena_topics', 289 'from_fieldname' => 'locked', 290 'to_type' => 'topic', 291 'to_fieldname' => '_bbp_old_closed_status_id', 292 'callback_method' => 'callback_topic_status' 293 ); 294 295 /** Tags Section ******************************************************/ 296 297 /** 298 * Kunena v3.x Forums do not support topic tags out of the box 299 */ 300 301 /** Reply Section ******************************************************/ 302 303 // Old reply id (Stored in postmeta) 304 $this->field_map[] = array( 305 'from_tablename' => 'kunena_messages', 306 'from_fieldname' => 'id', 307 'to_type' => 'reply', 308 'to_fieldname' => '_bbp_old_reply_id' 309 ); 310 311 // Reply parent forum id (If no parent, then 0. Stored in postmeta) 312 $this->field_map[] = array( 313 'from_tablename' => 'kunena_messages', 314 'from_fieldname' => 'catid', 315 'to_type' => 'reply', 316 'to_fieldname' => '_bbp_forum_id', 317 'callback_method' => 'callback_topicid_to_forumid' 318 ); 319 320 // Reply parent topic id (If no parent, then 0. Stored in postmeta) 321 $this->field_map[] = array( 322 'from_tablename' => 'kunena_messages', 323 'from_fieldname' => 'thread', 324 'to_type' => 'reply', 325 'to_fieldname' => '_bbp_topic_id', 326 'callback_method' => 'callback_topicid' 327 ); 328 329 // Reply author ip (Stored in postmeta) 330 $this->field_map[] = array( 331 'from_tablename' => 'kunena_messages', 332 'from_fieldname' => 'ip', 333 'to_type' => 'reply', 334 'to_fieldname' => '_bbp_author_ip' 335 ); 336 337 // Reply author. 338 $this->field_map[] = array( 339 'from_tablename' => 'kunena_messages', 340 'from_fieldname' => 'userid', 341 'to_type' => 'reply', 342 'to_fieldname' => 'post_author', 343 'callback_method' => 'callback_userid' 344 ); 345 346 // Reply content. 347 // Note: We join the 'kunena_messages_text' table because 'kunena_messages' table does not include reply content. 348 $this->field_map[] = array( 349 'from_tablename' => 'kunena_messages_text', 350 'from_fieldname' => 'message', 351 'join_tablename' => 'kunena_messages', 352 'join_type' => 'LEFT', 353 'join_expression' => 'ON kunena_messages_text.mesid = kunena_messages.id LEFT JOIN jos_kunena_topics AS kunena_topics ON kunena_messages.thread = kunena_topics.id WHERE kunena_messages.parent != 0', 354 'to_type' => 'reply', 355 'to_fieldname' => 'post_content', 356 'callback_method' => 'callback_html' 357 ); 358 359 // Reply parent topic id (If no parent, then 0) 360 $this->field_map[] = array( 361 'from_tablename' => 'kunena_messages', 362 'from_fieldname' => 'thread', 363 'to_type' => 'reply', 364 'to_fieldname' => 'post_parent', 365 'callback_method' => 'callback_topicid' 366 ); 367 368 // Reply dates. 369 $this->field_map[] = array( 370 'from_tablename' => 'kunena_messages', 371 'from_fieldname' => 'time', 372 'to_type' => 'reply', 373 'to_fieldname' => 'post_date', 374 'callback_method' => 'callback_datetime' 375 ); 376 $this->field_map[] = array( 377 'from_tablename' => 'kunena_messages', 378 'from_fieldname' => 'time', 379 'to_type' => 'reply', 380 'to_fieldname' => 'post_date_gmt', 381 'callback_method' => 'callback_datetime' 382 ); 383 $this->field_map[] = array( 384 'from_tablename' => 'kunena_messages', 385 'from_fieldname' => 'time', 386 'to_type' => 'reply', 387 'to_fieldname' => 'post_modified', 388 'callback_method' => 'callback_datetime' 389 ); 390 $this->field_map[] = array( 391 'from_tablename' => 'kunena_messages', 392 'from_fieldname' => 'time', 393 'to_type' => 'reply', 394 'to_fieldname' => 'post_modified_gmt', 395 'callback_method' => 'callback_datetime' 396 ); 397 398 /** User Section ******************************************************/ 399 400 //Note: We are importing the Joomla User details and the Kunena v3.x user profile details. 401 402 // Store old user id (Stored in usermeta) 403 $this->field_map[] = array( 404 'from_tablename' => 'users', 405 'from_fieldname' => 'id', 406 'to_type' => 'user', 407 'to_fieldname' => '_bbp_old_user_id' 408 ); 409 410 // Store old user password (Stored in usermeta serialized with salt) 411 $this->field_map[] = array( 412 'from_tablename' => 'users', 413 'from_fieldname' => 'password', 414 'to_type' => 'user', 415 'to_fieldname' => '_bbp_password', 416 'callback_method' => 'callback_savepass' 417 ); 418 419 // Store old user salt (This is only used for the SELECT row info for the above password save) 420 // $this->field_map[] = array( 421 // 'from_tablename' => 'users', 422 // 'from_fieldname' => 'salt', 423 // 'to_type' => 'user', 424 // 'to_fieldname' => '' 425 // ); 426 427 // User password verify class (Stored in usermeta for verifying password) 428 $this->field_map[] = array( 429 'to_type' => 'users', 430 'to_fieldname' => '_bbp_class', 431 'default' => 'Kunena3' 432 ); 433 434 // User name. 435 $this->field_map[] = array( 436 'from_tablename' => 'users', 437 'from_fieldname' => 'username', 438 'to_type' => 'user', 439 'to_fieldname' => 'user_login' 440 ); 441 442 // User nice name. 443 $this->field_map[] = array( 444 'from_tablename' => 'users', 445 'from_fieldname' => 'username', 446 'to_type' => 'user', 447 'to_fieldname' => 'user_nicename' 448 ); 449 450 // User email. 451 $this->field_map[] = array( 452 'from_tablename' => 'users', 453 'from_fieldname' => 'email', 454 'to_type' => 'user', 455 'to_fieldname' => 'user_email' 456 ); 457 458 // User homepage. 459 $this->field_map[] = array( 460 'from_tablename' => 'kunena_users', 461 'from_fieldname' => 'websiteurl', 462 'join_tablename' => 'users', 463 'join_type' => 'LEFT', 464 'join_expression' => 'ON kunena_users.userid = users.id', 465 'to_type' => 'user', 466 'to_fieldname' => 'user_url' 467 ); 468 469 // User registered. 470 $this->field_map[] = array( 471 'from_tablename' => 'users', 472 'from_fieldname' => 'registerDate', 473 'to_type' => 'user', 474 'to_fieldname' => 'user_registered', 475 'callback_method' => 'callback_datetime' 476 ); 477 478 // User display name. 479 $this->field_map[] = array( 480 'from_tablename' => 'users', 481 'from_fieldname' => 'name', 482 'to_type' => 'user', 483 'to_fieldname' => 'display_name' 484 ); 485 486 // User AIM (Stored in usermeta) 487 $this->field_map[] = array( 488 'from_tablename' => 'kunena_users', 489 'from_fieldname' => 'aim', 490 'join_tablename' => 'users', 491 'join_type' => 'LEFT', 492 'join_expression' => 'ON kunena_users.userid = users.id', 493 'to_type' => 'user', 494 'to_fieldname' => '_bbp_kunena3_user_aim' 495 ); 496 497 // User Yahoo (Stored in usermeta) 498 $this->field_map[] = array( 499 'from_tablename' => 'kunena_users', 500 'from_fieldname' => 'yim', 501 'join_tablename' => 'users', 502 'join_type' => 'LEFT', 503 'join_expression' => 'ON kunena_users.userid = users.id', 504 'to_type' => 'user', 505 'to_fieldname' => '_bbp_kunena3_user_yim' 506 ); 507 508 // Store Google Tak (Stored in usermeta) 509 $this->field_map[] = array( 510 'from_tablename' => 'kunena_users', 511 'from_fieldname' => 'gtalk', 512 'join_tablename' => 'users', 513 'join_type' => 'LEFT', 514 'join_expression' => 'ON kunena_users.userid = users.id', 515 'to_type' => 'user', 516 'to_fieldname' => '_bbp_kunena3_user_jabber' 517 ); 518 519 // Store ICQ (Stored in usermeta) 520 $this->field_map[] = array( 521 'from_tablename' => 'kunena_users', 522 'from_fieldname' => 'icq', 523 'join_tablename' => 'users', 524 'join_type' => 'LEFT', 525 'join_expression' => 'ON kunena_users.userid = users.id', 526 'to_type' => 'user', 527 'to_fieldname' => '_bbp_kunena3_user_icq' 528 ); 529 530 // Store MSN (Stored in usermeta) 531 $this->field_map[] = array( 532 'from_tablename' => 'kunena_users', 533 'from_fieldname' => 'msn', 534 'join_tablename' => 'users', 535 'join_type' => 'LEFT', 536 'join_expression' => 'ON kunena_users.userid = users.id', 537 'to_type' => 'user', 538 'to_fieldname' => '_bbp_kunena3_user_msn' 539 ); 540 541 // Store Skype (Stored in usermeta) 542 $this->field_map[] = array( 543 'from_tablename' => 'kunena_users', 544 'from_fieldname' => 'skype', 545 'join_tablename' => 'users', 546 'join_type' => 'LEFT', 547 'join_expression' => 'ON kunena_users.userid = users.id', 548 'to_type' => 'user', 549 'to_fieldname' => '_bbp_kunena3_user_skype' 550 ); 551 552 // Store Twitter (Stored in usermeta) 553 $this->field_map[] = array( 554 'from_tablename' => 'kunena_users', 555 'from_fieldname' => 'twitter', 556 'join_tablename' => 'users', 557 'join_type' => 'LEFT', 558 'join_expression' => 'ON kunena_users.userid = users.id', 559 'to_type' => 'user', 560 'to_fieldname' => '_bbp_kunena3_user_twitter' 561 ); 562 563 // Store Facebook (Stored in usermeta) 564 $this->field_map[] = array( 565 'from_tablename' => 'kunena_users', 566 'from_fieldname' => 'facebook', 567 'join_tablename' => 'users', 568 'join_type' => 'LEFT', 569 'join_expression' => 'ON kunena_users.userid = users.id', 570 'to_type' => 'user', 571 'to_fieldname' => '_bbp_kunena3_user_facebook' 572 ); 573 574 // Store myspace (Stored in usermeta) 575 $this->field_map[] = array( 576 'from_tablename' => 'kunena_users', 577 'from_fieldname' => 'myspace', 578 'join_tablename' => 'users', 579 'join_type' => 'LEFT', 580 'join_expression' => 'ON kunena_users.userid = users.id', 581 'to_type' => 'user', 582 'to_fieldname' => '_bbp_kunena3_user_myspace' 583 ); 584 585 // Store linkedin (Stored in usermeta) 586 $this->field_map[] = array( 587 'from_tablename' => 'kunena_users', 588 'from_fieldname' => 'linkedin', 589 'join_tablename' => 'users', 590 'join_type' => 'LEFT', 591 'join_expression' => 'ON kunena_users.userid = users.id', 592 'to_type' => 'user', 593 'to_fieldname' => '_bbp_kunena3_user_linkedin' 594 ); 595 596 // Store delicious (Stored in usermeta) 597 $this->field_map[] = array( 598 'from_tablename' => 'kunena_users', 599 'from_fieldname' => 'delicious', 600 'join_tablename' => 'users', 601 'join_type' => 'LEFT', 602 'join_expression' => 'ON kunena_users.userid = users.id', 603 'to_type' => 'user', 604 'to_fieldname' => '_bbp_kunena3_user_delicious' 605 ); 606 607 // Store friendfeed (Stored in usermeta) 608 $this->field_map[] = array( 609 'from_tablename' => 'kunena_users', 610 'from_fieldname' => 'friendfeed', 611 'join_tablename' => 'users', 612 'join_type' => 'LEFT', 613 'join_expression' => 'ON kunena_users.userid = users.id', 614 'to_type' => 'user', 615 'to_fieldname' => '_bbp_kunena3_user_friendfeed' 616 ); 617 618 // Store digg (Stored in usermeta) 619 $this->field_map[] = array( 620 'from_tablename' => 'kunena_users', 621 'from_fieldname' => 'digg', 622 'join_tablename' => 'users', 623 'join_type' => 'LEFT', 624 'join_expression' => 'ON kunena_users.userid = users.id', 625 'to_type' => 'user', 626 'to_fieldname' => '_bbp_kunena3_user_digg' 627 ); 628 629 // Store blogspot (Stored in usermeta) 630 $this->field_map[] = array( 631 'from_tablename' => 'kunena_users', 632 'from_fieldname' => 'blogspot', 633 'join_tablename' => 'users', 634 'join_type' => 'LEFT', 635 'join_expression' => 'ON kunena_users.userid = users.id', 636 'to_type' => 'user', 637 'to_fieldname' => '_bbp_kunena3_user_blogspot' 638 ); 639 640 // Store flickr (Stored in usermeta) 641 $this->field_map[] = array( 642 'from_tablename' => 'kunena_users', 643 'from_fieldname' => 'flickr', 644 'join_tablename' => 'users', 645 'join_type' => 'LEFT', 646 'join_expression' => 'ON kunena_users.userid = users.id', 647 'to_type' => 'user', 648 'to_fieldname' => '_bbp_kunena3_user_flickr' 649 ); 650 651 // Store bebo (Stored in usermeta) 652 $this->field_map[] = array( 653 'from_tablename' => 'kunena_users', 654 'from_fieldname' => 'bebo', 655 'join_tablename' => 'users', 656 'join_type' => 'LEFT', 657 'join_expression' => 'ON kunena_users.userid = users.id', 658 'to_type' => 'user', 659 'to_fieldname' => '_bbp_kunena3_user_bebo' 660 ); 661 662 // Store websitename (Stored in usermeta) 663 $this->field_map[] = array( 664 'from_tablename' => 'kunena_users', 665 'from_fieldname' => 'websitename', 666 'join_tablename' => 'users', 667 'join_type' => 'LEFT', 668 'join_expression' => 'ON kunena_users.userid = users.id', 669 'to_type' => 'user', 670 'to_fieldname' => '_bbp_kunena3_user_websitename' 671 ); 672 673 // Store location (Stored in usermeta) 674 $this->field_map[] = array( 675 'from_tablename' => 'kunena_users', 676 'from_fieldname' => 'location', 677 'join_tablename' => 'users', 678 'join_type' => 'LEFT', 679 'join_expression' => 'ON kunena_users.userid = users.id', 680 'to_type' => 'user', 681 'to_fieldname' => '_bbp_kunena3_user_location' 682 ); 683 684 // Store Signature (Stored in usermeta) 685 $this->field_map[] = array( 686 'from_tablename' => 'kunena_users', 687 'from_fieldname' => 'signature', 688 'join_tablename' => 'users', 689 'join_type' => 'LEFT', 690 'join_expression' => 'ON kunena_users.userid = users.id', 691 'to_type' => 'user', 692 'to_fieldname' => '_bbp_kunena3_user_sig', 693 'callback_method' => 'callback_html' 694 ); 695 } 696 697 /** 698 * This method allows us to indicates what is or is not converted for each 699 * converter. 700 */ 701 public function info() { 702 return ''; 703 } 704 705 /** 706 * This method is to save the salt and password together. That 707 * way when we authenticate it we can get it out of the database 708 * as one value. Array values are auto sanitized by WordPress. 709 */ 710 public function callback_savepass( $field, $row ) { 711 $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] ); 712 return $pass_array; 713 } 714 715 /** 716 * This method is to take the pass out of the database and compare 717 * to a pass the user has typed in. 718 */ 719 public function authenticate_pass( $password, $serialized_pass ) { 720 $pass_array = unserialize( $serialized_pass ); 721 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) ); 722 } 723 724 /** 725 * Translate the forum type from Kunena v3.x numerics to WordPress's strings. 726 * 727 * @param int $status Kunena v3.x numeric forum type 728 * @return string WordPress safe 729 */ 730 public function callback_forum_type( $status = 0 ) { 731 if ( $status == 0 ) { 732 $status = 'category'; 733 } else { 734 $status = 'forum'; 735 } 736 return $status; 737 } 738 739 /** 740 * Translate the forum status from Kunena v3.x numerics to WordPress's strings. 741 * 742 * @param int $status Kunena v3.x numeric forum status 743 * @return string WordPress safe 744 */ 745 public function callback_forum_status( $status = 0 ) { 746 switch ( $status ) { 747 case 1 : 748 $status = 'closed'; 749 break; 750 751 case 0 : 752 default : 753 $status = 'open'; 754 break; 755 } 756 return $status; 757 } 758 759 /** 760 * Translate the post status from Kunena v3.x numerics to WordPress's strings. 761 * 762 * @param int $status Kunena v3.x numeric topic status 763 * @return string WordPress safe 764 */ 765 public function callback_topic_status( $status = 0 ) { 766 switch ( $status ) { 767 case 1 : 768 $status = 'closed'; 769 break; 770 771 case 0 : 772 default : 773 $status = 'publish'; 774 break; 775 } 776 return $status; 777 } 778 779 /** 780 * Verify the topic/reply count. 781 * 782 * @param int $count Kunena v3.x topic/reply counts 783 * @return string WordPress safe 784 */ 785 public function callback_topic_reply_count( $count = 1 ) { 786 $count = absint( (int) $count - 1 ); 787 return $count; 788 } 789 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Dec 21 01:00:52 2024 | Cross-referenced by PHPXref 0.7.1 |