Skip to:
Content

bbPress.org

Ticket #2134: 2134.2.diff

File 2134.2.diff, 25.6 KB (added by netweb, 12 years ago)

Second pass includes all the possible 'to' fields for bbPress, adds common 'join' section in each section.

  • bbPress/admin/converters/Example.php

    diff --git a/bbPress/admin/converters/Example.php b/bbPress/admin/converters/Example.php
    index 4aa6dcf..6d80f85 100644
    a b  
    11<?php
    22
    33/**
    4  * Implementation of Example converter.
     4 * Example converter base impoprter template for bbPress
     5 *
     6 * @since bbPress (r4689)
     7 * @link Codex Docs http://codex.bbpress.org/import-forums/custom-import
    58 */
    6 class Example_Converter extends BBP_Converter_Base
    7 {
    8         function __construct()
    9         {
     9class Example extends BBP_Converter_Base {
     10
     11        /**
     12         * Main Constructor
     13         *
     14         * @uses Example_Converter::setup_globals()
     15         */
     16        function __construct() {
    1017                parent::__construct();
    1118                $this->setup_globals();
    1219        }
    1320
     21        /**
     22         * Sets up the field mappings
     23         */
    1424        public function setup_globals()
    1525        {
    1626                /** Forum Section ******************************************************/
    1727
    18                 // Forum id. Stored in postmeta.
     28                // Setup table joins for the forum section at the base of this section
     29
     30                // Forum id (Stored in postmeta)
    1931                $this->field_map[] = array(
    20                         'from_tablename' => 'forum', 'from_fieldname' => 'forumid',
    21                         'to_type' => 'forum', 'to_fieldname' => '_bbp_forum_id'
     32                        'from_tablename'  => 'forums_table',
     33                        'from_fieldname'  => 'the_forum_id',
     34                        'to_type'         => 'forum',
     35                        'to_fieldname'    => '_bbp_forum_id'
    2236                );
    23                
    24                 // Forum parent id.  If no parent, than 0. Stored in postmeta.
     37
     38                // Forum parent id (If no parent, then 0. Stored in postmeta)
    2539                $this->field_map[] = array(
    26                         'from_tablename' => 'forum', 'from_fieldname' => 'parentid',
    27                         'to_type' => 'forum', 'to_fieldname' => '_bbp_parent_id'
     40                        'from_tablename'  => 'forums_table',
     41                        'from_fieldname'  => 'the_parent_id',
     42                        'to_type'         => 'forum',
     43                        'to_fieldname'    => '_bbp_forum_parent_id'
    2844                );
    29                
     45
     46                // Forum topic count (Stored in postmeta)
     47                $this->field_map[] = array(
     48                        'from_tablename' => 'forums_table',
     49                        'from_fieldname' => 'the_topic_count',
     50                        'to_type'        => 'forum',
     51                        'to_fieldname'   => '_bbp_topic_count'
     52                );
     53
     54                // Forum reply count (Stored in postmeta)
     55                $this->field_map[] = array(
     56                        'from_tablename' => 'forums_table',
     57                        'from_fieldname' => 'the_reply_count',
     58                        'to_type'        => 'forum',
     59                        'to_fieldname'   => '_bbp_reply_count'
     60                );
     61
     62                // Forum total topic count (Stored in postmeta)
     63                $this->field_map[] = array(
     64                        'from_tablename' => 'forums_table',
     65                        'from_fieldname' => 'the_total_topic_count',
     66                        'to_type'        => 'forum',
     67                        'to_fieldname'   => '_bbp_total_topic_count'
     68                );
     69
     70                // Forum total reply count (Stored in postmeta)
     71                $this->field_map[] = array(
     72                        'from_tablename' => 'forums_table',
     73                        'from_fieldname' => 'the_total_reply_count',
     74                        'to_type'        => 'forum',
     75                        'to_fieldname'   => '_bbp_total_reply_count'
     76                );
     77
    3078                // Forum title.
    3179                $this->field_map[] = array(
    32                         'from_tablename' => 'forum', 'from_fieldname' => 'title',
    33                         'to_type' => 'forum', 'to_fieldname' => 'post_title'
     80                        'from_tablename'  => 'forums_table',
     81                        'from_fieldname'  => 'the_forum_title',
     82                        'to_type'         => 'forum',
     83                        'to_fieldname'    => 'post_title'
    3484                );
    35                
    36                 // Forum slug. Clean name.
     85
     86                // Forum slug (Clean name to avoid confilcts)
    3787                $this->field_map[] = array(
    38                         'from_tablename' => 'forum', 'from_fieldname' => 'title_clean',
    39                         'to_type' => 'forum', 'to_fieldname' => 'post_name',
     88                        'from_tablename'  => 'forums_table',
     89                        'from_fieldname'  => 'the_forum_slug',
     90                        'to_type'         => 'forum',
     91                        'to_fieldname'    => 'post_name',
    4092                        'callback_method' => 'callback_slug'
    4193                );
    42                
     94
    4395                // Forum description.
    4496                $this->field_map[] = array(
    45                         'from_tablename' => 'forum', 'from_fieldname' => 'description',
    46                         'to_type' => 'forum', 'to_fieldname' => 'post_content',
     97                        'from_tablename'  => 'forums_table',
     98                        'from_fieldname'  => 'the_forum_description',
     99                        'to_type'         => 'forum',
     100                        'to_fieldname'    => 'post_content',
    47101                        'callback_method' => 'callback_null'
    48102                );
    49                
    50                 // Forum display order.  Starts from 1.
     103
     104                // Forum display order (Starts from 1)
    51105                $this->field_map[] = array(
    52                         'from_tablename' => 'forum', 'from_fieldname' => 'displayorder',
    53                         'to_type' => 'forum', 'to_fieldname' => 'menu_order'
     106                        'from_tablename'  => 'forums_table',
     107                        'from_fieldname'  => 'the_forum_order',
     108                        'to_type'         => 'forum',
     109                        'to_fieldname'    => 'menu_order'
    54110                );
    55                
    56                 // Forum date update.
     111
     112                // Forum dates.
    57113                $this->field_map[] = array(
    58                         'to_type' => 'forum', 'to_fieldname' => 'post_date',
     114                        'to_type'         => 'forum',
     115                        'to_fieldname'    => 'post_date',
    59116                        'default' => date('Y-m-d H:i:s')
    60117                );
    61118                $this->field_map[] = array(
    62                         'to_type' => 'forum', 'to_fieldname' => 'post_date_gmt',
     119                        'to_type'         => 'forum',
     120                        'to_fieldname'    => 'post_date_gmt',
    63121                        'default' => date('Y-m-d H:i:s')
    64122                );
    65123                $this->field_map[] = array(
    66                         'to_type' => 'forum', 'to_fieldname' => 'post_modified',
     124                        'to_type'         => 'forum',
     125                        'to_fieldname'    => 'post_modified',
    67126                        'default' => date('Y-m-d H:i:s')
    68127                );
    69128                $this->field_map[] = array(
    70                         'to_type' => 'forum', 'to_fieldname' => 'post_modified_gmt',
     129                        'to_type'         => 'forum',
     130                        'to_fieldname'    => 'post_modified_gmt',
    71131                        'default' => date('Y-m-d H:i:s')
    72132                );
    73133
     134                // Setup the table joins for the forum section
     135                $this->field_map[] = array(
     136                        'from_tablename'  => 'groups_table',
     137                        'from_fieldname'  => 'forum_id',
     138                        'join_tablename'  => 'forums_table',
     139                        'join_type'       => 'INNER',
     140                        'join_expression' => 'USING groups_table.forum_id = forums_table.forum_id',
     141                //      'from_expression' => 'WHERE forums_table.forum_id != 1',
     142                        'to_type'         => 'forum'
     143                );
     144
    74145                /** Topic Section ******************************************************/
    75146
    76                 // Topic id. Stored in postmeta.
     147                // Setup table joins for the topic section at the base of this section
     148
     149                // Topic id (Stored in postmeta)
    77150                $this->field_map[] = array(
    78                         'from_tablename' => 'thread', 'from_fieldname' => 'threadid',
    79                         'to_type' => 'topic', 'to_fieldname' => '_bbp_topic_id'
     151                        'from_tablename'  => 'topics_table',
     152                        'from_fieldname'  => 'the_topic_id',
     153                        'to_type'         => 'topic',
     154                        'to_fieldname'    => '_bbp_topic_id'
    80155                );
    81                
    82                 // Forum id. Stored in postmeta.
     156
     157                // Topic reply count (Stored in postmeta)
    83158                $this->field_map[] = array(
    84                         'from_tablename' => 'thread', 'from_fieldname' => 'forumid',
    85                         'to_type' => 'topic', 'to_fieldname' => '_bbp_forum_id',
     159                        'from_tablename'  => 'topics_table',
     160                        'from_fieldname'  => 'the_topic_reply_count',
     161                        'to_type'         => 'topic',
     162                        'to_fieldname'    => '_bbp_reply_count',
     163                        'callback_method' => 'callback_topic_reply_count'
     164                );
     165
     166                // Topic total reply count (Stored in postmeta)
     167                $this->field_map[] = array(
     168                        'from_tablename'  => 'topics_table',
     169                        'from_fieldname'  => 'the_total_topic_reply_count',
     170                        'to_type'         => 'topic',
     171                        'to_fieldname'    => '_bbp_total_reply_count',
     172                        'callback_method' => 'callback_topic_reply_count'
     173                );
     174
     175                // Topic parent forum id (If no parent, then 0. Stored in postmeta)
     176                $this->field_map[] = array(
     177                        'from_tablename'  => 'topics_table',
     178                        'from_fieldname'  => 'the_topic_parent_forum_id',
     179                        'to_type'         => 'topic',
     180                        'to_fieldname'    => '_bbp_forum_id',
    86181                        'callback_method' => 'callback_forumid'
    87182                );
    88                                
     183
    89184                // Topic author.
    90185                $this->field_map[] = array(
    91                         'from_tablename' => 'thread', 'from_fieldname' => 'postuserid',
    92                         'to_type' => 'topic', 'to_fieldname' => 'post_author',
     186                        'from_tablename'  => 'topics_table',
     187                        'from_fieldname'  => 'the_topic_author_id',
     188                        'to_type'         => 'topic',
     189                        'to_fieldname'    => 'post_author',
    93190                        'callback_method' => 'callback_userid'
    94191                );
    95                
     192
     193                // Topic author ip (Stored in postmeta)
     194                $this->field_map[] = array(
     195                        'from_tablename'  => 'topics_table',
     196                        'from_fieldname'  => 'the_topic_author_ip_address',
     197                        'to_type'         => 'topic',
     198                        'to_fieldname'    => '_bbp_author_ip'
     199                );
     200
     201                // Topic content.
     202                $this->field_map[] = array(
     203                        'from_tablename'  => 'topics_table',
     204                        'from_fieldname'  => 'the_topic_content',
     205                        'to_type'         => 'topic',
     206                        'to_fieldname'    => 'post_content',
     207                        'callback_method' => 'callback_html'
     208                );
     209
    96210                // Topic title.
    97211                $this->field_map[] = array(
    98                         'from_tablename' => 'thread', 'from_fieldname' => 'title',
    99                         'to_type' => 'topic', 'to_fieldname' => 'post_title'
     212                        'from_tablename'  => 'topics_table',
     213                        'from_fieldname'  => 'the_topic_title',
     214                        'to_type'         => 'topic',
     215                        'to_fieldname'    => 'post_title'
    100216                );
    101                
    102                 // Topic slug. Clean name.
     217
     218                // Topic slug (Clean name to avoid conflicts)
    103219                $this->field_map[] = array(
    104                         'from_tablename' => 'thread', 'from_fieldname' => 'title',
    105                         'to_type' => 'topic', 'to_fieldname' => 'post_name',
     220                        'from_tablename'  => 'topics_table',
     221                        'from_fieldname'  => 'the_topic_slug',
     222                        'to_type'         => 'topic',
     223                        'to_fieldname'    => 'post_name',
    106224                        'callback_method' => 'callback_slug'
    107225                );
    108                
    109                 // Forum id.  If no parent, than 0.
     226
     227                // Topic parent forum id (If no parent, then 0)
    110228                $this->field_map[] = array(
    111                         'from_tablename' => 'thread', 'from_fieldname' => 'forumid',
    112                         'to_type' => 'topic', 'to_fieldname' => 'post_parent',
     229                        'from_tablename'  => 'topics_table',
     230                        'from_fieldname'  => 'the_topic_parent_forum_id',
     231                        'to_type'         => 'topic',
     232                        'to_fieldname'    => 'post_parent',
    113233                        'callback_method' => 'callback_forumid'
    114234                );
    115235
    116                 // Topic date update.
     236                // Topic dates.
     237                $this->field_map[] = array(
     238                        'from_tablename'  => 'topics_table',
     239                        'from_fieldname'  => 'the_topic_creation_date',
     240                        'to_type'         => 'topic',
     241                        'to_fieldname'    => 'post_date',
     242                        'callback_method' => 'callback_datetime'
     243                );
    117244                $this->field_map[] = array(
    118                         'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    119                         'to_type' => 'topic', 'to_fieldname' => 'post_date',
     245                        'from_tablename'  => 'topics_table',
     246                        'from_fieldname'  => 'the_topic_creation_date',
     247                        'to_type'         => 'topic',
     248                        'to_fieldname'    => 'post_date_gmt',
    120249                        'callback_method' => 'callback_datetime'
    121250                );
    122251                $this->field_map[] = array(
    123                         'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    124                         'to_type' => 'topic', 'to_fieldname' => 'post_date_gmt',
     252                        'from_tablename'  => 'topics_table',
     253                        'from_fieldname'  => 'the_topic_modified_date',
     254                        'to_type'         => 'topic',
     255                        'to_fieldname'    => 'post_modified',
    125256                        'callback_method' => 'callback_datetime'
    126257                );
    127258                $this->field_map[] = array(
    128                         'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    129                         'to_type' => 'topic', 'to_fieldname' => 'post_modified',
     259                        'from_tablename'  => 'topics_table',
     260                        'from_fieldname'  => 'the_topic_modified_date',
     261                        'to_type'         => 'topic',
     262                        'to_fieldname'    => 'post_modified_gmt',
    130263                        'callback_method' => 'callback_datetime'
    131264                );
    132265                $this->field_map[] = array(
    133                         'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    134                         'to_type' => 'topic', 'to_fieldname' => 'post_modified_gmt',
     266                        'from_tablename'  => 'topics_table',
     267                        'from_fieldname'  => 'the_topic_modified_date',
     268                        'to_type'         => 'topic',
     269                        'to_fieldname'    => '_bbp_last_active_time',
    135270                        'callback_method' => 'callback_datetime'
    136271                );
    137272
     273                // Setup any table joins needed for the topic section
     274                $this->field_map[] = array(
     275                        'from_tablename'  => 'replies_table',
     276                        'from_fieldname'  => 'the_topic_id',
     277                        'join_tablename'  => 'topics_table',
     278                        'join_type'       => 'INNER',
     279                        'join_expression' => 'USING replies_table.the_topic_id = topics_table.the_topic_id',
     280                        'from_expression' => 'WHERE forums_table.the_topic_id = 0',
     281                        'to_type'         => 'topic'
     282                );
     283
    138284                /** Tags Section ******************************************************/
    139                
     285
     286                // Setup table joins for the tag section at the base of this section
     287                // Setup any table joins needed for the tags section
     288                $this->field_map[] = array(
     289                        'from_tablename'  => 'tag_table',
     290                        'from_fieldname'  => 'the_topic_id',
     291                        'join_tablename'  => 'tagcontent_table',
     292                        'join_type'       => 'INNER',
     293                        'join_expression' => 'USING tagcontent_table.tag_id = tags_table.tag_id',
     294                        'from_expression' => 'WHERE tagcontent_table.tag_id = tag_table.tag_id',
     295                        'to_type'         => 'tags'
     296                );
     297
    140298                // Topic id.
    141299                $this->field_map[] = array(
    142                         'from_tablename' => 'tagcontent', 'from_fieldname' => 'contentid',
    143                         'to_type' => 'tags', 'to_fieldname' => 'objectid',
     300                        'from_tablename'  => 'tagcontent_table',
     301                        'from_fieldname'  => 'contentid',
     302                        'to_type'         => 'tags',
     303                        'to_fieldname'    => 'objectid',
    144304                        'callback_method' => 'callback_topicid'
    145305                );
    146                
    147                 // Tags text.
     306
     307                // Taxonomy ID.
    148308                $this->field_map[] = array(
    149                         'from_tablename' => 'tag', 'from_fieldname' => 'tagtext',
    150                         'join_tablename' => 'tagcontent', 'join_type' => 'INNER', 'join_expression' => 'USING (tagid)',
    151                         'to_type' => 'tags', 'to_fieldname' => 'name'
    152                 );             
     309                        'from_tablename'  => 'tagcontent_table',
     310                        'from_fieldname'  => 'tagid',
     311                        'to_type'         => 'tags',
     312                        'to_fieldname'    => 'taxonomy'
     313                );
     314
     315                // Term text.
     316                $this->field_map[] = array(
     317                        'from_tablename'  => 'tag_table',
     318                        'from_fieldname'  => 'tagtext',
     319                        'to_type'         => 'tags',
     320                        'to_fieldname'    => 'name'
     321                );
     322
     323                /** Reply Section ******************************************************/
    153324
    154                 /** Post Section ******************************************************/
     325                // Setup table joins for the reply section at the base of this section
    155326
    156                 // Post id. Stores in postmeta.
     327                // Reply id (Stored in postmeta)
    157328                $this->field_map[] = array(
    158                         'from_tablename' => 'post', 'from_fieldname' => 'postid',
    159                         'to_type' => 'reply', 'to_fieldname' => '_bbp_post_id'
     329                        'from_tablename'  => 'replies_table',
     330                        'from_fieldname'  => 'the_reply_id',
     331                        'to_type'         => 'reply',
     332                        'to_fieldname'    => '_bbp_post_id'
    160333                );
    161                
    162                 // Forum id. Stores in postmeta.
     334
     335                // Reply parent forum id (If no parent, then 0. Stored in postmeta)
    163336                $this->field_map[] = array(
    164                         'from_tablename' => 'post', 'from_fieldname' => 'threadid',
    165                         'to_type' => 'reply', 'to_fieldname' => '_bbp_forum_id',
     337                        'from_tablename'  => 'replies_table',
     338                        'from_fieldname'  => 'the_reply_parent_forum_id',
     339                        'to_type'         => 'reply',
     340                        'to_fieldname'    => '_bbp_forum_id',
    166341                        'callback_method' => 'callback_topicid_to_forumid'
    167342                );
    168                
    169                 // Topic id. Stores in postmeta.
     343
     344                // Reply parent topic id (If no parent, then 0. Stored in postmeta)
    170345                $this->field_map[] = array(
    171                         'from_tablename' => 'post', 'from_fieldname' => 'threadid',
    172                         'to_type' => 'reply', 'to_fieldname' => '_bbp_topic_id',
     346                        'from_tablename'  => 'replies_table',
     347                        'from_fieldname'  => 'the_reply_parent_topic_id',
     348                        'to_type'         => 'reply',
     349                        'to_fieldname'    => '_bbp_topic_id',
    173350                        'callback_method' => 'callback_topicid'
    174351                );
    175                
    176                 // Author ip.
     352
     353                // Reply author ip (Stored in postmeta)
    177354                $this->field_map[] = array(
    178                         'from_tablename' => 'post', 'from_fieldname' => 'ipaddress',
    179                         'to_type' => 'reply', 'to_fieldname' => '__bbp_author_ip'
    180                 );     
    181                        
    182                 // Post author.
     355                        'from_tablename'  => 'replies_table',
     356                        'from_fieldname'  => 'the_reply_author_ip_address',
     357                        'to_type'         => 'reply',
     358                        'to_fieldname'    => '_bbp_author_ip'
     359                );
     360       
     361                // Reply author.
    183362                $this->field_map[] = array(
    184                         'from_tablename' => 'post', 'from_fieldname' => 'userid',
    185                         'to_type' => 'reply', 'to_fieldname' => 'post_author',
     363                        'from_tablename'  => 'replies_table',
     364                        'from_fieldname'  => 'the_reply_author_id',
     365                        'to_type'         => 'reply',
     366                        'to_fieldname'    => 'post_author',
    186367                        'callback_method' => 'callback_userid'
    187368                );
    188                
    189                 // Topic title.
     369
     370                // Reply title.
    190371                $this->field_map[] = array(
    191                         'from_tablename' => 'post', 'from_fieldname' => 'title',
    192                         'to_type' => 'reply', 'to_fieldname' => 'post_title'
     372                        'from_tablename'  => 'replies_table',
     373                        'from_fieldname'  => 'the_reply_title',
     374                        'to_type'         => 'reply',
     375                        'to_fieldname'    => 'post_title'
    193376                );
    194                
    195                 // Topic slug. Clean name.
     377
     378                // Reply slug (Clean name to avoid conflicts)
    196379                $this->field_map[] = array(
    197                         'from_tablename' => 'post', 'from_fieldname' => 'title',
    198                         'to_type' => 'reply', 'to_fieldname' => 'post_name',
     380                        'from_tablename'  => 'replies_table',
     381                        'from_fieldname'  => 'the_reply_slug',
     382                        'to_type'         => 'reply',
     383                        'to_fieldname'    => 'post_name',
    199384                        'callback_method' => 'callback_slug'
    200385                );
    201                
    202                 // Post content.
     386
     387                // Reply content.
    203388                $this->field_map[] = array(
    204                         'from_tablename' => 'post', 'from_fieldname' => 'pagetext',
    205                         'to_type' => 'reply', 'to_fieldname' => 'post_content',
     389                        'from_tablename'  => 'replies_table',
     390                        'from_fieldname'  => 'the_reply_content',
     391                        'to_type'         => 'reply',
     392                        'to_fieldname'    => 'post_content',
    206393                        'callback_method' => 'callback_html'
    207394                );
    208                
    209                 // Topic id.  If no parent, than 0.
     395
     396                // Reply order.
     397                $this->field_map[] = array(
     398                        'from_tablename'  => 'replies_table',
     399                        'from_fieldname'  => 'the_reply_order',
     400                        'to_type'         => 'reply',
     401                        'to_fieldname'    => 'menu_order'
     402                );
     403
     404                // Reply parent topic id (If no parent, then 0)
    210405                $this->field_map[] = array(
    211                         'from_tablename' => 'post', 'from_fieldname' => 'threadid',
    212                         'to_type' => 'reply', 'to_fieldname' => 'post_parent',
     406                        'from_tablename'  => 'replies_table',
     407                        'from_fieldname'  => 'the_reply_parent_topic_id',
     408                        'to_type'         => 'reply',
     409                        'to_fieldname'    => 'post_parent',
    213410                        'callback_method' => 'callback_topicid'
    214411                );
    215412
    216                 // Topic date update.
     413                // Reply dates.
    217414                $this->field_map[] = array(
    218                         'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    219                         'to_type' => 'reply', 'to_fieldname' => 'post_date',
     415                        'from_tablename'  => 'replies_table',
     416                        'from_fieldname'  => 'the_reply_creation_date',
     417                        'to_type'         => 'reply',
     418                        'to_fieldname'    => 'post_date',
    220419                        'callback_method' => 'callback_datetime'
    221420                );
    222421                $this->field_map[] = array(
    223                         'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    224                         'to_type' => 'reply', 'to_fieldname' => 'post_date_gmt',
     422                        'from_tablename'  => 'replies_table',
     423                        'from_fieldname'  => 'the_reply_creation_date',
     424                        'to_type'         => 'reply',
     425                        'to_fieldname'    => 'post_date_gmt',
    225426                        'callback_method' => 'callback_datetime'
    226427                );
    227428                $this->field_map[] = array(
    228                         'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    229                         'to_type' => 'reply', 'to_fieldname' => 'post_modified',
     429                        'from_tablename'  => 'replies_table',
     430                        'from_fieldname'  => 'the_reply_modified_date',
     431                        'to_type'         => 'reply',
     432                        'to_fieldname'    => 'post_modified',
    230433                        'callback_method' => 'callback_datetime'
    231434                );
    232435                $this->field_map[] = array(
    233                         'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    234                         'to_type' => 'reply', 'to_fieldname' => 'post_modified_gmt',
     436                        'from_tablename'  => 'replies_table',
     437                        'from_fieldname'  => 'the_reply_modified_date',
     438                        'to_type'         => 'reply',
     439                        'to_fieldname'    => 'post_modified_gmt',
    235440                        'callback_method' => 'callback_datetime'
    236441                );
    237442
     443                // Setup any table joins needed for the reply section
     444                $this->field_map[] = array(
     445                        'from_tablename'  => 'topics_table',
     446                        'from_fieldname'  => 'the_topic_id',
     447                        'join_tablename'  => 'replies_table',
     448                        'join_type'       => 'INNER',
     449                        'join_expression' => 'USING topics_table.the_topic_id = replies_table.the_topic_id',
     450                        'from_expression' => 'WHERE topics_table.first_post != 0',
     451                        'to_type'         => 'reply'
     452                );
     453
    238454                /** User Section ******************************************************/
    239455
    240                 // Store old User id. Stores in usermeta.
     456                // Setup table joins for the user section at the base of this section
     457               
     458                // Store old User id (Stored in usermeta)
    241459                $this->field_map[] = array(
    242                         'from_tablename' => 'user', 'from_fieldname' => 'userid',
    243                         'to_type' => 'user', 'to_fieldname' => '_bbp_user_id'
     460                        'from_tablename'  => 'users_table',
     461                        'from_fieldname'  => 'the_users_id',
     462                        'to_type'         => 'user',
     463                        'to_fieldname'    => '_bbp_user_id'
    244464                );
    245                
    246                 // Store old User password. Stores in usermeta serialized with salt.
     465
     466                // Store old User password (Stored in usermeta serialized with salt)
    247467                $this->field_map[] = array(
    248                         'from_tablename' => 'user', 'from_fieldname' => 'password',
    249                         'to_type' => 'user', 'to_fieldname' => '_bbp_password',
     468                        'from_tablename'  => 'users_table',
     469                        'from_fieldname'  => 'the_users_password',
     470                        'to_type'         => 'user',
     471                        'to_fieldname'    => '_bbp_password',
    250472                        'callback_method' => 'callback_savepass'
    251473                );
    252474
    253                 // Store old User Salt. This is only used for the SELECT row info for the above password save
     475                // Store old User Salt (This is only used for the SELECT row info for the above password save)
    254476                $this->field_map[] = array(
    255                         'from_tablename' => 'user', 'from_fieldname' => 'salt',
    256                         'to_type' => 'user', 'to_fieldname' => ''
     477                        'from_tablename'  => 'users_table',
     478                        'from_fieldname'  => 'the_users_password_salt',
     479                        'to_type'         => 'user',
     480                        'to_fieldname'    => ''
    257481                );
    258                                
    259                 // User password verify class. Stores in usermeta for verifying password.
     482
     483                // User password verify class (Stored in usermeta for verifying password)
    260484                $this->field_map[] = array(
    261                         'to_type' => 'user', 'to_fieldname' => '_bbp_class',
    262                         'default' => 'Vbulletin'
     485                        'to_type'         => 'user',
     486                        'to_fieldname'    => '_bbp_class',
     487                        'default' => 'Example'
    263488                );
    264                
     489
    265490                // User name.
    266491                $this->field_map[] = array(
    267                         'from_tablename' => 'user', 'from_fieldname' => 'username',
    268                         'to_type' => 'user', 'to_fieldname' => 'user_login'
     492                        'from_tablename'  => 'users_table',
     493                        'from_fieldname'  => 'the_users_username',
     494                        'to_type'         => 'user',
     495                        'to_fieldname'    => 'user_login'
     496                );
     497
     498                // User nice name.
     499                $this->field_map[] = array(
     500                        'from_tablename' => 'users_table',
     501                        'from_fieldname' => 'the_users_nicename',
     502                        'to_type'        => 'user',
     503                        'to_fieldname'   => 'user_nicename'
    269504                );
    270                                
     505
    271506                // User email.
    272507                $this->field_map[] = array(
    273                         'from_tablename' => 'user', 'from_fieldname' => 'email',
    274                         'to_type' => 'user', 'to_fieldname' => 'user_email'
     508                        'from_tablename'  => 'users_table',
     509                        'from_fieldname'  => 'the_users_email_address',
     510                        'to_type'         => 'user',
     511                        'to_fieldname'    => 'user_email'
    275512                );
    276                
     513
    277514                // User homepage.
    278515                $this->field_map[] = array(
    279                         'from_tablename' => 'user', 'from_fieldname' => 'homepage',
    280                         'to_type' => 'user', 'to_fieldname' => 'user_url'
     516                        'from_tablename'  => 'users_table',
     517                        'from_fieldname'  => 'the_users_homepage_url',
     518                        'to_type'         => 'user',
     519                        'to_fieldname'    => 'user_url'
    281520                );
    282                
     521
    283522                // User registered.
    284523                $this->field_map[] = array(
    285                         'from_tablename' => 'user', 'from_fieldname' => 'joindate',
    286                         'to_type' => 'user', 'to_fieldname' => 'user_registered',
     524                        'from_tablename'  => 'users_table',
     525                        'from_fieldname'  => 'the_users_registration_date',
     526                        'to_type'         => 'user',
     527                        'to_fieldname'    => 'user_registered',
    287528                        'callback_method' => 'callback_datetime'
    288529                );
    289                
    290                 // User aim.
     530
     531                // User status.
    291532                $this->field_map[] = array(
    292                         'from_tablename' => 'user', 'from_fieldname' => 'aim',
    293                         'to_type' => 'user', 'to_fieldname' => 'aim'
     533                        'from_tablename' => 'users_table',
     534                        'from_fieldname' => 'the_users_status',
     535                        'to_type'        => 'user',
     536                        'to_fieldname'   => 'user_status'
    294537                );
    295                
    296                 // User yahoo.
     538
     539                // User display name.
     540                $this->field_map[] = array(
     541                        'from_tablename' => 'users_table',
     542                        'from_fieldname' => 'the_users_display_name',
     543                        'to_type'        => 'user',
     544                        'to_fieldname'   => 'display_name'
     545                );
     546
     547                // User AIM (Stored in usermeta)
     548                $this->field_map[] = array(
     549                        'from_tablename'  => 'users_table',
     550                        'from_fieldname'  => 'the_users_aim',
     551                        'to_type'         => 'user',
     552                        'to_fieldname'    => 'aim'
     553                );
     554
     555                // User Yahoo (Stored in usermeta)
     556                $this->field_map[] = array(
     557                        'from_tablename'  => 'users_table',
     558                        'from_fieldname'  => 'the_users_yahoo',
     559                        'to_type'         => 'user',
     560                        'to_fieldname'    => 'yim'
     561                );
     562
     563                // User Jabber (Stored in usermeta)
     564                $this->field_map[] = array(
     565                        'from_tablename' => 'users_table',
     566                        'from_fieldname' => 'the_users_jabber',
     567                        'to_type'        => 'user',
     568                        'to_fieldname'   => 'jabber'
     569                );
     570
     571                // Setup any table joins needed for the user section
    297572                $this->field_map[] = array(
    298                         'from_tablename' => 'user', 'from_fieldname' => 'yahoo',
    299                         'to_type' => 'user', 'to_fieldname' => 'yim'
    300                 );     
     573                        'from_tablename'  => 'users_profile_table',
     574                        'from_fieldname'  => 'the_users_id',
     575                        'join_tablename'  => 'users_table',
     576                        'join_type'       => 'INNER',
     577                        'join_expression' => 'USING users_profile_table.the_user_id = users_table.the_user_id',
     578                        'from_expression' => 'WHERE users_table.the_user_id != -1',
     579                        'to_type'         => 'user'
     580                );
    301581        }
    302        
     582
    303583        /**
    304584         * This method allows us to indicates what is or is not converted for each
    305585         * converter.