Skip to:
Content

bbPress.org

Ticket #2126: 2126.1.diff

File 2126.1.diff, 32.6 KB (added by netweb, 10 years ago)
  • includes/admin/converter.php

     
    437437
    438438                                break;
    439439
    440                         // STEP 7. Convert tags.
     440                        // STEP 7. Stick topics.
    441441                        case 7 :
     442                                if ( $converter->convert_topic_stickies( $start ) ) {
     443                                        update_option( '_bbp_converter_step',  $step + 1 );
     444                                        update_option( '_bbp_converter_start', 0         );
     445                                        if ( empty( $start ) ) {
     446                                                $this->converter_output( __( 'No stickies to stick', 'bbpress' ) );
     447                                        }
     448                                } else {
     449                                        update_option( '_bbp_converter_start', $max + 1 );
     450                                        $this->converter_output( sprintf( __( 'Calculating topic stickies (%1$s - %2$s)', 'bbpress' ), $min, $max ) );
     451                                }
     452
     453                                break;
     454
     455                        // STEP 8. Stick to front topics (Super Sicky).
     456                        case 8 :
     457                                if ( $converter->convert_topic_super_stickies( $start ) ) {
     458                                        update_option( '_bbp_converter_step',  $step + 1 );
     459                                        update_option( '_bbp_converter_start', 0         );
     460                                        if ( empty( $start ) ) {
     461                                                $this->converter_output( __( 'No super stickies to stick', 'bbpress' ) );
     462                                        }
     463                                } else {
     464                                        update_option( '_bbp_converter_start', $max + 1 );
     465                                        $this->converter_output( sprintf( __( 'Calculating topic super stickies (%1$s - %2$s)', 'bbpress' ), $min, $max ) );
     466                                }
     467
     468                                break;
     469
     470                        // STEP 9. Convert tags.
     471                        case 9 :
    442472                                if ( $converter->convert_tags( $start ) ) {
    443473                                        update_option( '_bbp_converter_step',  $step + 1 );
    444474                                        update_option( '_bbp_converter_start', 0         );
     
    452482
    453483                                break;
    454484
    455                         // STEP 8. Convert replies.
    456                         case 8 :
     485                        // STEP 10. Convert replies.
     486                        case 10 :
    457487                                if ( $converter->convert_replies( $start ) ) {
    458488                                        update_option( '_bbp_converter_step',  $step + 1 );
    459489                                        update_option( '_bbp_converter_start', 0         );
     
    467497
    468498                                break;
    469499
    470                         // STEP 9. Convert reply_to parents.
    471                         case 9 :
     500                        // STEP 11. Convert reply_to parents.
     501                        case 11 :
    472502                                if ( $converter->convert_reply_to_parents( $start ) ) {
    473503                                        update_option( '_bbp_converter_step',  $step + 1 );
    474504                                        update_option( '_bbp_converter_start', 0         );
     
    10281058        }
    10291059
    10301060        /**
     1061         * This method converts old topic stickies to new bbPress stickies.
     1062         *
     1063         * @since bbPress (r)
     1064         *
     1065         * @uses WPDB $wpdb
     1066         * @uses bbp_stick_topic() to set the imported topic as sticky
     1067         *
     1068         */
     1069        public function convert_topic_stickies( $start ) {
     1070
     1071                $has_update = false;
     1072
     1073                if ( !empty( $this->sync_table ) ) {
     1074                        $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_sticky_status" AND meta_value = "sticky" LIMIT ' . $start . ', ' . $this->max_rows;
     1075                } else {
     1076                        $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_sticky_status" AND meta_value = "sticky" LIMIT ' . $start . ', ' . $this->max_rows;
     1077                }
     1078
     1079                update_option( '_bbp_converter_query', $query );
     1080
     1081                $sticky_array = $this->wpdb->get_results( $query );
     1082
     1083                foreach ( (array) $sticky_array as $row ) {
     1084                        bbp_stick_topic( $row->value_id );
     1085                        $has_update = true;
     1086                }
     1087
     1088                return ! $has_update;
     1089        }
     1090
     1091        /**
     1092         * This method converts old topic super stickies to new bbPress super stickies.
     1093         *
     1094         * @since bbPress (r)
     1095         *
     1096         * @uses WPDB $wpdb
     1097         * @uses bbp_stick_topic() to set the imported topic as super sticky
     1098         *
     1099         */
     1100        public function convert_topic_super_stickies( $start ) {
     1101
     1102                $has_update = false;
     1103
     1104                if ( !empty( $this->sync_table ) ) {
     1105                        $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_sticky_status" AND meta_value = "super-sticky" LIMIT ' . $start . ', ' . $this->max_rows;
     1106                } else {
     1107                        $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_sticky_status" AND meta_value = "super-sticky" LIMIT ' . $start . ', ' . $this->max_rows;
     1108                }
     1109
     1110                update_option( '_bbp_converter_query', $query );
     1111
     1112                $sticky_array = $this->wpdb->get_results( $query );
     1113
     1114                foreach ( (array) $sticky_array as $row ) {
     1115                        $super = true;
     1116                        bbp_stick_topic( $row->value_id, $super );
     1117                        $has_update = true;
     1118                }
     1119
     1120                return ! $has_update;
     1121        }
     1122
     1123        /**
    10311124         * This method converts old reply_to post id to new bbPress reply_to post id.
    10321125         */
    10331126        public function convert_reply_to_parents( $start ) {
  • includes/admin/converters/AEF.php

     
    239239                        'callback_method' => 'callback_forumid'
    240240                );
    241241
     242                // Sticky status (Stored in postmeta))
     243                $this->field_map[] = array(
     244                        'from_tablename'  => 'topics',
     245                        'from_fieldname'  => 't_sticky',
     246                        'to_type'         => 'topic',
     247                        'to_fieldname'    => '_bbp_old_sticky_status',
     248                        'callback_method' => 'callback_sticky_status'
     249                );
     250
    242251                // Topic dates.
    243252                // Note: We join the 'posts' table because 'topics' table does not include topic dates.
    244253                $this->field_map[] = array(
     
    639648        }
    640649
    641650        /**
     651         * Translate the topic sticky status type from AEF 1.x numeric's to WordPress's strings.
     652         *
     653         * @param int $status AEF 1.x numeric forum type
     654         * @return string WordPress safe
     655         */
     656        public function callback_sticky_status( $status = 0 ) {
     657                switch ( $status ) {
     658                        case 1 :
     659                                $status = 'sticky';       // AEF Sticky 't_sticky = 1'
     660                                break;
     661
     662                        case 0  :
     663                        default :
     664                                $status = 'normal';       // AEF normal topic 't_sticky = 0'
     665                                break;
     666                }
     667                return $status;
     668        }
     669
     670        /**
    642671         * Verify the topic/reply count.
    643672         *
    644673         * @param int $count AEF v1.0.9 topic/reply counts
  • includes/admin/converters/bbPress1.php

     
    250250                        'callback_method' => 'callback_forumid'
    251251                );
    252252
     253                // Sticky status (Stored in postmeta))
     254                $this->field_map[] = array(
     255                        'from_tablename'  => 'topics',
     256                        'from_fieldname'  => 'topic_sticky',
     257                        'to_type'         => 'topic',
     258                        'to_fieldname'    => '_bbp_old_sticky_status',
     259                        'callback_method' => 'callback_sticky_status'
     260                );
     261
    253262                // Topic dates.
    254263                $this->field_map[] = array(
    255264                        'from_tablename' => 'topics',
     
    357366                );
    358367
    359368                // Reply slug (Clean name to avoid conflicts)
    360                 // Note: We join the 'topics' table because 'posts' table does not include topic title.
     369                // Note: We join the 'topics' table because 'posts' table does not include topic slug.
    361370                $this->field_map[] = array(
    362371                        'from_tablename'  => 'topics',
    363372                        'from_fieldname'  => 'topic_slug',
     
    571580        }
    572581
    573582        /**
     583         * Translate the topic sticky status type from bbPress 1.x numeric's to WordPress's strings.
     584         *
     585         * @param int $status bbPress 1.x numeric forum type
     586         * @return string WordPress safe
     587         */
     588        public function callback_sticky_status( $status = 0 ) {
     589                switch ( $status ) {
     590                        case 2 :
     591                                $status = 'super-sticky'; // bbPress Super Sticky 'topic_sticky = 2'
     592                                break;
     593
     594                        case 1 :
     595                                $status = 'sticky';       // bbPress Sticky 'topic_sticky = 1'
     596                                break;
     597
     598                        case 0  :
     599                        default :
     600                                $status = 'normal';       // bbPress Normal Topic 'topic_sticky = 0'
     601                                break;
     602                }
     603                return $status;
     604        }
     605
     606        /**
    574607         * Verify the topic reply count.
    575608         *
    576609         * @param int $count bbPress 1.x topic and reply counts
  • includes/admin/converters/Drupal7.php

     
    190190                        'callback_method' => 'callback_forumid'
    191191                );
    192192
     193                // Sticky status (Stored in postmeta))
     194                $this->field_map[] = array(
     195                        'from_tablename'  => 'forum_index',
     196                        'from_fieldname'  => 'sticky',
     197                        'to_type'         => 'topic',
     198                        'to_fieldname'    => '_bbp_old_sticky_status',
     199                        'callback_method' => 'callback_sticky_status'
     200                );
     201
    193202                // Topic dates.
    194203                $this->field_map[] = array(
    195204                        'from_tablename'  => 'forum_index',
     
    549558        }
    550559
    551560        /**
     561         * Translate the topic sticky status type from Drupal v7.x numeric's to WordPress's strings.
     562         *
     563         * @param int $status Drupal v7.x numeric forum type
     564         * @return string WordPress safe
     565         */
     566        public function callback_sticky_status( $status = 0 ) {
     567                switch ( $status ) {
     568                        case 1 :
     569                                $status = 'sticky'; // Drupal Sticky 'topic_sticky = 1'
     570                                break;
     571
     572                        case 0  :
     573                        default :
     574                                $status = 'normal'; // Drupal Normal Topic 'sticky = 0'
     575                                break;
     576                }
     577                return $status;
     578        }
     579
     580        /**
    552581         * Verify the topic/reply count.
    553582         *
    554583         * @param int $count Drupal v7.x topic/reply counts
  • includes/admin/converters/Example.php

     
    11<?php
    22
    33/**
    4  * Example converter base impoprter template for bbPress 
     4 * Example converter base impoprter template for bbPress
    55 *
    66 * @since bbPress (r4689)
    77 * @link Codex Docs http://codex.bbpress.org/import-forums/custom-import
     
    233233                        'callback_method' => 'callback_forumid'
    234234                );
    235235
     236                // Sticky status (Stored in postmeta))
     237                $this->field_map[] = array(
     238                        'from_tablename'  => 'topics_table',
     239                        'from_fieldname'  => 'the_topic_sticky_status',
     240                        'to_type'         => 'topic',
     241                        'to_fieldname'    => '_bbp_old_sticky_status',
     242                        'callback_method' => 'callback_sticky_status'
     243                );
     244
    236245                // Topic dates.
    237246                $this->field_map[] = array(
    238247                        'from_tablename'  => 'topics_table',
     
    357366                        'to_type'         => 'reply',
    358367                        'to_fieldname'    => '_bbp_author_ip'
    359368                );
    360        
     369
    361370                // Reply author.
    362371                $this->field_map[] = array(
    363372                        'from_tablename'  => 'replies_table',
     
    454463                /** User Section ******************************************************/
    455464
    456465                // Setup table joins for the user section at the base of this section
    457                
     466
    458467                // Store old User id (Stored in usermeta)
    459468                $this->field_map[] = array(
    460469                        'from_tablename'  => 'users_table',
  • includes/admin/converters/FluxBB.php

     
    222222                        'callback_method' => 'callback_forumid'
    223223                );
    224224
     225                // Sticky status (Stored in postmeta))
     226                $this->field_map[] = array(
     227                        'from_tablename'  => 'topics',
     228                        'from_fieldname'  => 'sticky',
     229                        'to_type'         => 'topic',
     230                        'to_fieldname'    => '_bbp_old_sticky_status',
     231                        'callback_method' => 'callback_sticky_status'
     232                );
     233
    225234                // Topic dates.
    226235                $this->field_map[] = array(
    227236                        'from_tablename'  => 'topics',
     
    594603        }
    595604
    596605        /**
     606         * Translate the topic sticky status type from FluxBB v1.5.3 numeric's to WordPress's strings.
     607         *
     608         * @param int $status FluxBB v1.5.3 numeric forum type
     609         * @return string WordPress safe
     610         */
     611        public function callback_sticky_status( $status = 0 ) {
     612                switch ( $status ) {
     613                        case 1 :
     614                                $status = 'sticky';       // FluxBB Sticky 'sticky = 1'
     615                                break;
     616
     617                        case 0  :
     618                        default :
     619                                $status = 'normal';       // FluxBB Normal Topic 'sticky = 0'
     620                                break;
     621                }
     622                return $status;
     623        }
     624
     625        /**
    597626         * Verify the topic/reply count.
    598627         *
    599628         * @param int $count FluxBB v1.5.3 topic/reply counts
  • includes/admin/converters/Invision.php

     
    214214                        'callback_method' => 'callback_forumid'
    215215                );
    216216
     217                // Sticky status (Stored in postmeta))
     218                $this->field_map[] = array(
     219                        'from_tablename'  => 'topics',
     220                        'from_fieldname'  => 'pinned',
     221                        'to_type'         => 'topic',
     222                        'to_fieldname'    => '_bbp_old_sticky_status',
     223                        'callback_method' => 'callback_sticky_status'
     224                );
     225
    217226                // Topic dates.
    218227                $this->field_map[] = array(
    219228                        'from_tablename'  => 'topics',
     
    476485        }
    477486
    478487        /**
     488         * Translate the topic sticky status type from Invision numeric's to WordPress's strings.
     489         *
     490         * @param int $status Invision numeric forum type
     491         * @return string WordPress safe
     492         */
     493        public function callback_sticky_status( $status = 0 ) {
     494                switch ( $status ) {
     495                        case 1 :
     496                                $status = 'sticky';       // Invision Pinned Topic 'pinned = 1'
     497                                break;
     498
     499                        case 0  :
     500                        default :
     501                                $status = 'normal';       // Invision Normal Topic 'pinned = 0'
     502                                break;
     503                }
     504                return $status;
     505        }
     506
     507        /**
    479508         * Verify the topic reply count.
    480509         *
    481510         * @param int $count Invision reply count
  • includes/admin/converters/Mingle.php

     
    162162                        'callback_method' => 'callback_forumid'
    163163                );
    164164
     165                // Sticky status (Stored in postmeta))
     166                $this->field_map[] = array(
     167                        'from_tablename'  => 'forum_threads',
     168                        'from_fieldname'  => 'status',
     169                        'to_type'         => 'topic',
     170                        'to_fieldname'    => '_bbp_old_sticky_status',
     171                        'callback_method' => 'callback_sticky_status'
     172                );
     173
    165174                // Topic dates.
    166175                $this->field_map[] = array(
    167176                        'from_tablename'  => 'forum_threads',
     
    441450        }
    442451
    443452        /**
     453         * Translate the topic sticky status type from Mingle numeric's to WordPress's strings.
     454         *
     455         * @param int $status Mingle numeric forum type
     456         * @return string WordPress safe
     457         */
     458        public function callback_sticky_status( $status = 0 ) {
     459                switch ( $status ) {
     460                        case 'sticky' :
     461                                $status = 'sticky';       // Mingle Sticky 'status = sticky'
     462                                break;
     463
     464                        case 'open'  :
     465                        default :
     466                                $status = 'normal';       // Mingle Normal Topic 'status = open'
     467                                break;
     468                }
     469                return $status;
     470        }
     471
     472        /**
    444473        * This callback processes any custom BBCodes with parser.php
    445474        */
    446475        protected function callback_html( $field ) {
  • includes/admin/converters/MyBB.php

     
    209209                        'callback_method' => 'callback_forumid'
    210210                );
    211211
     212                // Sticky status (Stored in postmeta))
     213                $this->field_map[] = array(
     214                        'from_tablename'  => 'threads',
     215                        'from_fieldname'  => 'sticky',
     216                        'to_type'         => 'topic',
     217                        'to_fieldname'    => '_bbp_old_sticky_status',
     218                        'callback_method' => 'callback_sticky_status'
     219                );
     220
    212221                // Topic dates.
    213222                $this->field_map[] = array(
    214223                        'from_tablename'  => 'threads',
     
    549558        }
    550559
    551560        /**
     561         * Translate the topic sticky status type from MyBB v1.6.10 numeric's to WordPress's strings.
     562         *
     563         * @param int $status MyBB v1.6.10 numeric forum type
     564         * @return string WordPress safe
     565         */
     566        public function callback_sticky_status( $status = 0 ) {
     567                switch ( $status ) {
     568                        case 1 :
     569                                $status = 'sticky';       // MyBB Sticky 'topic_sticky = 1'
     570                                break;
     571
     572                        case 0  :
     573                        default :
     574                                $status = 'normal';       // MyBB Normal Topic 'topic_sticky = 0'
     575                                break;
     576                }
     577                return $status;
     578        }
     579
     580        /**
    552581         * Verify the topic/reply count.
    553582         *
    554583         * @param int $count MyBB v1.6.10 topic/reply counts
  • includes/admin/converters/phpBB.php

     
    193193                        'callback_method' => 'callback_userid'
    194194                );
    195195
     196                // Topic Author ip (Stored in postmeta)
     197                $this->field_map[] = array(
     198                        'from_tablename'  => 'posts',
     199                        'from_fieldname'  => 'poster_ip',
     200                        'join_tablename'  => 'topics',
     201                        'join_type'       => 'INNER',
     202                        'join_expression' => 'USING (topic_id) WHERE posts.post_id = topics.topic_first_post_id',
     203                        'to_type'         => 'topic',
     204                        'to_fieldname'    => '_bbp_author_ip'
     205                );
     206
    196207                // Topic content.
    197                 // Note: We join the 'posts' table because 'topics' do not have content.
     208                // Note: We join the 'posts' table because 'topics' does not include topic content.
    198209                $this->field_map[] = array(
    199210                        'from_tablename'  => 'posts',
    200211                        'from_fieldname'  => 'post_text',
     
    223234                        'callback_method' => 'callback_slug'
    224235                );
    225236
     237                // Topic status (Open or Closed)
     238                $this->field_map[] = array(
     239                        'from_tablename'  => 'topics',
     240                        'from_fieldname'  => 'topic_status',
     241                        'to_type'         => 'topic',
     242                        'to_fieldname'    => 'post_status',
     243                        'callback_method' => 'callback_topic_status'
     244                );
     245
    226246                // Topic parent forum id (If no parent, then 0)
    227247                $this->field_map[] = array(
    228248                        'from_tablename'  => 'topics',
     
    232252                        'callback_method' => 'callback_forumid'
    233253                );
    234254
     255                // Sticky status (Stored in postmeta))
     256                $this->field_map[] = array(
     257                        'from_tablename'  => 'topics',
     258                        'from_fieldname'  => 'topic_type',
     259                        'to_type'         => 'topic',
     260                        'to_fieldname'    => '_bbp_old_sticky_status',
     261                        'callback_method' => 'callback_sticky_status'
     262                );
     263
    235264                // Topic dates.
    236265                $this->field_map[] = array(
    237266                        'from_tablename'  => 'topics',
     
    269298                        'callback_method' => 'callback_datetime'
    270299                );
    271300
    272                 // Topic status (Open or Closed)
    273                 $this->field_map[] = array(
    274                         'from_tablename'  => 'topics',
    275                         'from_fieldname'  => 'topic_status',
    276                         'to_type'         => 'topic',
    277                         'to_fieldname'    => 'post_status',
    278                         'callback_method' => 'callback_topic_status'
    279                 );
    280 
    281                 // Topic Author ip (Stored in postmeta)
    282                 $this->field_map[] = array(
    283                         'from_tablename'  => 'posts',
    284                         'from_fieldname'  => 'poster_ip',
    285                         'join_tablename'  => 'topics',
    286                         'join_type'       => 'INNER',
    287                         'join_expression' => 'USING (topic_id) WHERE posts.post_id = topics.topic_first_post_id',
    288                         'to_type'         => 'topic',
    289                         'to_fieldname'    => '_bbp_author_ip'
    290                 );
    291 
    292301                /** Tags Section ******************************************************/
    293302
    294303                /**
     
    759768        }
    760769
    761770        /**
     771         * Translate the topic sticky status type from phpBB 3.x numeric's to WordPress's strings.
     772         *
     773         * @param int $status phpBB 3.x numeric forum type
     774         * @return string WordPress safe
     775         */
     776        public function callback_sticky_status( $status = 0 ) {
     777                switch ( $status ) {
     778                        case 3 :
     779                                $status = 'super-sticky'; // phpBB Global Sticky 'topic_type = 3'
     780                                break;
     781
     782                        case 2 :
     783                                $status = 'super-sticky'; // phpBB Announcement Sticky 'topic_type = 2'
     784                                break;
     785
     786                        case 1 :
     787                                $status = 'sticky';       // phpBB Sticky 'topic_type = 1'
     788                                break;
     789
     790                        case 0  :
     791                        default :
     792                                $status = 'normal';       // phpBB normal topic 'topic_type = 0'
     793                                break;
     794                }
     795                return $status;
     796        }
     797
     798        /**
    762799         * Verify the topic reply count.
    763800         *
    764801         * @param int $count phpBB v3.x reply count
  • includes/admin/converters/PHPFox3.php

     
    233233                        'callback_method' => 'callback_forumid'
    234234                );
    235235
     236                // Topic status (Open or Closed, PHPFox v3.5.x 0=open & 1=closed)
     237                $this->field_map[] = array(
     238                        'from_tablename'  => 'forum_thread',
     239                        'from_fieldname'  => 'is_closed',
     240                        'to_type'         => 'topic',
     241                        'to_fieldname'    => 'post_status',
     242                        'callback_method' => 'callback_topic_status'
     243                );
     244
     245                // Sticky status (Stored in postmeta))
     246                $this->field_map[] = array(
     247                        'from_tablename'  => 'forum_thread',
     248                        'from_fieldname'  => 'order_id',
     249                        'to_type'         => 'topic',
     250                        'to_fieldname'    => '_bbp_old_sticky_status',
     251                        'callback_method' => 'callback_sticky_status'
     252                );
     253
    236254                // Topic dates.
    237255                $this->field_map[] = array(
    238256                        'from_tablename'  => 'forum_thread',
     
    270288                        'callback_method' => 'callback_datetime'
    271289                );
    272290
    273                 // Topic status (Open or Closed, PHPFox v3.5.x 0=open & 1=closed)
    274                 $this->field_map[] = array(
    275                         'from_tablename'  => 'forum_thread',
    276                         'from_fieldname'  => 'is_closed',
    277                         'to_type'         => 'topic',
    278                         'to_fieldname'    => 'post_status',
    279                         'callback_method' => 'callback_topic_status'
    280                 );
    281 
    282291                /** Tags Section ******************************************************/
    283292
    284293                // Topic id.
     
    591600        }
    592601
    593602        /**
     603         * Translate the topic sticky status type from PHPFox v3.5.x numeric's to WordPress's strings.
     604         *
     605         * @param int $status PHPFox v3.5.x numeric forum type
     606         * @return string WordPress safe
     607         */
     608        public function callback_sticky_status( $status = 0 ) {
     609                switch ( $status ) {
     610                        case 1 :
     611                                $status = 'sticky';       // PHPFox Sticky 'topic_sticky = 1'
     612                                break;
     613
     614                        case 0  :
     615                        default :
     616                                $status = 'normal';       // PHPFox Normal Topic 'topic_sticky = 0'
     617                                break;
     618                }
     619                return $status;
     620        }
     621
     622        /**
    594623         * Verify the topic/reply count.
    595624         *
    596625         * @param int $count PHPFox v3.5.x topic/reply counts
  • includes/admin/converters/PunBB.php

     
    222222                        'callback_method' => 'callback_forumid'
    223223                );
    224224
     225                // Topic status (Open or Closed, PunBB v1.4.2 0=open & 1=closed)
     226                $this->field_map[] = array(
     227                        'from_tablename'  => 'topics',
     228                        'from_fieldname'  => 'closed',
     229                        'to_type'         => 'topic',
     230                        'to_fieldname'    => 'post_status',
     231                        'callback_method' => 'callback_topic_status'
     232                );
     233
     234                // Sticky status (Stored in postmeta))
     235                $this->field_map[] = array(
     236                        'from_tablename'  => 'topics',
     237                        'from_fieldname'  => 'sticky',
     238                        'to_type'         => 'topic',
     239                        'to_fieldname'    => '_bbp_old_sticky_status',
     240                        'callback_method' => 'callback_sticky_status'
     241                );
    225242                // Topic dates.
    226243                $this->field_map[] = array(
    227244                        'from_tablename'  => 'topics',
     
    259276                        'callback_method' => 'callback_datetime'
    260277                );
    261278
    262                 // Topic status (Open or Closed, PunBB v1.4.2 0=open & 1=closed)
    263                 $this->field_map[] = array(
    264                         'from_tablename'  => 'topics',
    265                         'from_fieldname'  => 'closed',
    266                         'to_type'         => 'topic',
    267                         'to_fieldname'    => 'post_status',
    268                         'callback_method' => 'callback_topic_status'
    269                 );
    270 
    271279                /** Tags Section ******************************************************/
    272280
    273281                /**
     
    629637        }
    630638
    631639        /**
     640         * Translate the topic sticky status type from PunBB v1.4.2 numeric's to WordPress's strings.
     641         *
     642         * @param int $status PunBB v1.4.2 numeric forum type
     643         * @return string WordPress safe
     644         */
     645        public function callback_sticky_status( $status = 0 ) {
     646                switch ( $status ) {
     647                        case 1 :
     648                                $status = 'sticky';       // PunBB Sticky 'topic_sticky = 1'
     649                                break;
     650
     651                        case 0  :
     652                        default :
     653                                $status = 'normal';       // PunBB Normal Topic 'topic_sticky = 0'
     654                                break;
     655                }
     656                return $status;
     657        }
     658
     659        /**
    632660         * Verify the topic/reply count.
    633661         *
    634662         * @param int $count PunBB v1.4.2 topic/reply counts
  • includes/admin/converters/SimplePress5.php

     
    205205                        'callback_method' => 'callback_forumid'
    206206                );
    207207
     208                // Topic status (Open or Closed)
     209                $this->field_map[] = array(
     210                        'from_tablename'  => 'sftopics',
     211                        'from_fieldname'  => 'topic_status',
     212                        'to_type'         => 'topic',
     213                        'to_fieldname'    => 'post_status',
     214                        'callback_method' => 'callback_status'
     215                );
     216
     217                // Sticky status (Stored in postmeta))
     218                $this->field_map[] = array(
     219                        'from_tablename'  => 'sftopics',
     220                        'from_fieldname'  => 'topic_pinned',
     221                        'to_type'         => 'topic',
     222                        'to_fieldname'    => '_bbp_old_sticky_status',
     223                        'callback_method' => 'callback_sticky_status'
     224                );
     225
    208226                // Topic dates.
    209227                $this->field_map[] = array(
    210228                        'from_tablename'  => 'sftopics',
     
    237255                        'to_fieldname'    => '_bbp_last_active_time'
    238256                );
    239257
    240                 // Topic status (Open or Closed)
    241                 $this->field_map[] = array(
    242                         'from_tablename'  => 'sftopics',
    243                         'from_fieldname'  => 'topic_status',
    244                         'to_type'         => 'topic',
    245                         'to_fieldname'    => 'post_status',
    246                         'callback_method' => 'callback_status'
    247                 );
    248 
    249258                /** Tags Section ******************************************************/
    250259
    251260                /**
     
    488497        }
    489498
    490499        /**
     500         * Translate the topic sticky status type from Simple:Press v5.x numeric's to WordPress's strings.
     501         *
     502         * @param int $status Simple:Press v5.x numeric forum type
     503         * @return string WordPress safe
     504         */
     505        public function callback_sticky_status( $status = 0 ) {
     506                switch ( $status ) {
     507                        case 1 :
     508                                $status = 'sticky';       // Simple:Press Sticky 'topic_sticky = 1'
     509                                break;
     510
     511                        case 0  :
     512                        default :
     513                                $status = 'normal';       // Simple:Press Normal Topic 'topic_sticky = 0'
     514                                break;
     515                }
     516                return $status;
     517        }
     518
     519        /**
    491520         * Verify the topic reply count.
    492521         *
    493522         * @param int $count Simple:Press v5.x reply count
  • includes/admin/converters/vBulletin.php

     
    235235                        'callback_method' => 'callback_html'
    236236                );
    237237
     238                // Topic status (Open or Closed)
     239                $this->field_map[] = array(
     240                        'from_tablename'  => 'thread',
     241                        'from_fieldname'  => 'open',
     242                        'to_type'         => 'topic',
     243                        'to_fieldname'    => 'post_status',
     244                        'callback_method' => 'callback_topic_status'
     245                );
     246
     247                // Sticky status (Stored in postmeta))
     248                $this->field_map[] = array(
     249                        'from_tablename'  => 'thread',
     250                        'from_fieldname'  => 'sticky',
     251                        'to_type'         => 'topic',
     252                        'to_fieldname'    => '_bbp_old_sticky_status',
     253                        'callback_method' => 'callback_sticky_status'
     254                );
     255
    238256                // Topic dates.
    239257                $this->field_map[] = array(
    240258                        'from_tablename'  => 'thread',
     
    272290                        'callback_method' => 'callback_datetime'
    273291                );
    274292
    275                 // Topic status (Open or Closed)
    276                 $this->field_map[] = array(
    277                         'from_tablename'  => 'thread',
    278                         'from_fieldname'  => 'open',
    279                         'to_type'         => 'topic',
    280                         'to_fieldname'    => 'post_status',
    281                         'callback_method' => 'callback_topic_status'
    282                 );
    283 
    284293                /** Tags Section ******************************************************/
    285294
    286295                // Topic id.
     
    587596        }
    588597
    589598        /**
     599         * Translate the topic sticky status type from vBulletin v4.x numeric's to WordPress's strings.
     600         *
     601         * @param int $status vBulletin v4.x numeric forum type
     602         * @return string WordPress safe
     603         */
     604        public function callback_sticky_status( $status = 0 ) {
     605                switch ( $status ) {
     606                        case 2 :
     607                                $status = 'super-sticky'; // vBulletin Super Sticky 'sticky = 2'
     608                                break;
     609
     610                        case 1 :
     611                                $status = 'sticky';       // vBulletin Sticky 'sticky = 1'
     612                                break;
     613
     614                        case 0  :
     615                        default :
     616                                $status = 'normal';       // vBulletin Normal Topic 'sticky = 0'
     617                                break;
     618                }
     619                return $status;
     620        }
     621
     622        /**
    590623         * Verify the topic reply count.
    591624         *
    592625         * @param int $count vBulletin v4.x reply count
  • includes/admin/converters/vBulletin3.php

     
    235235                        'callback_method' => 'callback_html'
    236236                );
    237237
     238                // Topic status (Open or Closed)
     239                $this->field_map[] = array(
     240                        'from_tablename'  => 'thread',
     241                        'from_fieldname'  => 'open',
     242                        'to_type'         => 'topic',
     243                        'to_fieldname'    => 'post_status',
     244                        'callback_method' => 'callback_topic_status'
     245                );
     246
     247                // Sticky status (Stored in postmeta))
     248                $this->field_map[] = array(
     249                        'from_tablename'  => 'thread',
     250                        'from_fieldname'  => 'sticky',
     251                        'to_type'         => 'topic',
     252                        'to_fieldname'    => '_bbp_old_sticky_status',
     253                        'callback_method' => 'callback_sticky_status'
     254                );
     255
    238256                // Topic dates.
    239257                $this->field_map[] = array(
    240258                        'from_tablename'  => 'thread',
     
    272290                        'callback_method' => 'callback_datetime'
    273291                );
    274292
    275                 // Topic status (Open or Closed)
    276                 $this->field_map[] = array(
    277                         'from_tablename'  => 'thread',
    278                         'from_fieldname'  => 'open',
    279                         'to_type'         => 'topic',
    280                         'to_fieldname'    => 'post_status',
    281                         'callback_method' => 'callback_topic_status'
    282                 );
    283 
    284293                /** Tags Section ******************************************************/
    285294
    286295                // Topic id.
     
    591600        }
    592601
    593602        /**
     603         * Translate the topic sticky status type from vBulletin v3.x numeric's to WordPress's strings.
     604         *
     605         * @param int $status vBulletin v3.x numeric forum type
     606         * @return string WordPress safe
     607         */
     608        public function callback_sticky_status( $status = 0 ) {
     609                switch ( $status ) {
     610                        case 1 :
     611                                $status = 'sticky';       // vBulletin Sticky 'topic_sticky = 1'
     612                                break;
     613
     614                        case 0  :
     615                        default :
     616                                $status = 'normal';       // vBulletin Normal Topic 'topic_sticky = 0'
     617                                break;
     618                }
     619                return $status;
     620        }
     621
     622        /**
    594623         * Verify the topic reply count.
    595624         *
    596625         * @param int $count vBulletin v3.x reply count
  • includes/admin/converters/XenForo.php

     
    262262                        'callback_method' => 'callback_forumid'
    263263                );
    264264
     265                // Sticky status (Stored in postmeta))
     266                $this->field_map[] = array(
     267                        'from_tablename'  => 'thread',
     268                        'from_fieldname'  => 'sticky',
     269                        'to_type'         => 'topic',
     270                        'to_fieldname'    => '_bbp_old_sticky_status',
     271                        'callback_method' => 'callback_sticky_status'
     272                );
     273
    265274                // Topic dates.
    266275                $this->field_map[] = array(
    267276                        'from_tablename'  => 'thread',
     
    671680                }
    672681                return $status;
    673682        }
     683
    674684        /**
     685         * Translate the topic sticky status type from XenForo numeric's to WordPress's strings.
     686         *
     687         * @param int $status XenForo numeric forum type
     688         * @return string WordPress safe
     689         */
     690        public function callback_sticky_status( $status = 0 ) {
     691                switch ( $status ) {
     692                        case 1 :
     693                                $status = 'sticky';       // XenForo Sticky 'sticky = 1'
     694                                break;
     695
     696                        case 0  :
     697                        default :
     698                                $status = 'normal';       // XenForo Normal Topic 'sticky = 0'
     699                                break;
     700                }
     701                return $status;
     702        }
     703
     704        /**
    675705         * Verify the topic reply count.
    676706         *
    677707         * @param int $count XenForo reply count
  • includes/admin/converters/XMB.php

     
    239239                        'callback_method' => 'callback_forumid'
    240240                );
    241241
     242                // Topic status (Open or Closed, XMB v1.9.11.13 ''=open & 'yes'=closed)
     243                $this->field_map[] = array(
     244                        'from_tablename'  => 'threads',
     245                        'from_fieldname'  => 'closed',
     246                        'to_type'         => 'topic',
     247                        'to_fieldname'    => 'post_status',
     248                        'callback_method' => 'callback_topic_status'
     249                );
     250
     251                // Sticky status (Stored in postmeta))
     252                $this->field_map[] = array(
     253                        'from_tablename'  => 'threads',
     254                        'from_fieldname'  => 'topped',
     255                        'to_type'         => 'topic',
     256                        'to_fieldname'    => '_bbp_old_sticky_status',
     257                        'callback_method' => 'callback_sticky_status'
     258                );
     259
    242260                // Topic dates.
    243261                // Note: We join the 'posts' table because 'threads' table does not include dates.
    244262                $this->field_map[] = array(
     
    292310                        'callback_method' => 'callback_datetime'
    293311                );
    294312
    295                 // Topic status (Open or Closed, XMB v1.9.11.13 ''=open & 'yes'=closed)
    296                 $this->field_map[] = array(
    297                         'from_tablename'  => 'threads',
    298                         'from_fieldname'  => 'closed',
    299                         'to_type'         => 'topic',
    300                         'to_fieldname'    => 'post_status',
    301                         'callback_method' => 'callback_topic_status'
    302                 );
    303 
    304313                /** Tags Section ******************************************************/
    305314
    306315                /**
     
    656665        }
    657666
    658667        /**
     668         * Translate the topic sticky status type from XMB v1.9.11.13 numeric's to WordPress's strings.
     669         *
     670         * @param int $status XMB v1.9.11.13 numeric forum type
     671         * @return string WordPress safe
     672         */
     673        public function callback_sticky_status( $status = 0 ) {
     674                switch ( $status ) {
     675                        case 1 :
     676                                $status = 'sticky';       // XMB Sticky 'topped = 1'
     677                                break;
     678
     679                        case 0  :
     680                        default :
     681                                $status = 'normal';       // XMB Normal Topic 'topped = 0'
     682                                break;
     683                }
     684                return $status;
     685        }
     686
     687        /**
    659688         * Verify the topic/reply count.
    660689         *
    661690         * @param int $count XMB v1.9.11.13 topic/reply counts