Skip to:
Content

bbPress.org

Changeset 5014


Ignore:
Timestamp:
07/10/2013 06:22:23 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Clean-up to Example.php converter. Props netweb. Fixes #2134.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/admin/converters/Example.php

    r4824 r5014  
    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
    14     public function setup_globals()
    15     {
    16         /** Forum Section ******************************************************/
    17 
    18         // Forum id. Stored in postmeta.
    19         $this->field_map[] = array(
    20             'from_tablename' => 'forum', 'from_fieldname' => 'forumid',
    21             'to_type' => 'forum', 'to_fieldname' => '_bbp_forum_id'
    22         );
     21    /**
     22     * Sets up the field mappings
     23     */
     24    public function setup_globals() {
     25
     26        /** Forum Section *****************************************************/
     27
     28        // Setup table joins for the forum section at the base of this section
     29
     30        // Forum id (Stored in postmeta)
     31        $this->field_map[] = array(
     32            'from_tablename'  => 'forums_table',
     33            'from_fieldname'  => 'the_forum_id',
     34            'to_type'         => 'forum',
     35            'to_fieldname'    => '_bbp_forum_id'
     36        );
     37
     38        // Forum parent id (If no parent, then 0. Stored in postmeta)
     39        $this->field_map[] = array(
     40            'from_tablename'  => 'forums_table',
     41            'from_fieldname'  => 'the_parent_id',
     42            'to_type'         => 'forum',
     43            'to_fieldname'    => '_bbp_forum_parent_id'
     44        );
     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
     78        // Forum title.
     79        $this->field_map[] = array(
     80            'from_tablename'  => 'forums_table',
     81            'from_fieldname'  => 'the_forum_title',
     82            'to_type'         => 'forum',
     83            'to_fieldname'    => 'post_title'
     84        );
     85
     86        // Forum slug (Clean name to avoid confilcts)
     87        $this->field_map[] = array(
     88            'from_tablename'  => 'forums_table',
     89            'from_fieldname'  => 'the_forum_slug',
     90            'to_type'         => 'forum',
     91            'to_fieldname'    => 'post_name',
     92            'callback_method' => 'callback_slug'
     93        );
     94
     95        // Forum description.
     96        $this->field_map[] = array(
     97            'from_tablename'  => 'forums_table',
     98            'from_fieldname'  => 'the_forum_description',
     99            'to_type'         => 'forum',
     100            'to_fieldname'    => 'post_content',
     101            'callback_method' => 'callback_null'
     102        );
     103
     104        // Forum display order (Starts from 1)
     105        $this->field_map[] = array(
     106            'from_tablename'  => 'forums_table',
     107            'from_fieldname'  => 'the_forum_order',
     108            'to_type'         => 'forum',
     109            'to_fieldname'    => 'menu_order'
     110        );
     111
     112        // Forum dates.
     113        $this->field_map[] = array(
     114            'to_type'         => 'forum',
     115            'to_fieldname'    => 'post_date',
     116            'default' => date('Y-m-d H:i:s')
     117        );
     118        $this->field_map[] = array(
     119            'to_type'         => 'forum',
     120            'to_fieldname'    => 'post_date_gmt',
     121            'default' => date('Y-m-d H:i:s')
     122        );
     123        $this->field_map[] = array(
     124            'to_type'         => 'forum',
     125            'to_fieldname'    => 'post_modified',
     126            'default' => date('Y-m-d H:i:s')
     127        );
     128        $this->field_map[] = array(
     129            'to_type'         => 'forum',
     130            'to_fieldname'    => 'post_modified_gmt',
     131            'default' => date('Y-m-d H:i:s')
     132        );
     133
     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
     145        /** Topic Section *****************************************************/
     146
     147        // Setup table joins for the topic section at the base of this section
     148
     149        // Topic id (Stored in postmeta)
     150        $this->field_map[] = array(
     151            'from_tablename'  => 'topics_table',
     152            'from_fieldname'  => 'the_topic_id',
     153            'to_type'         => 'topic',
     154            'to_fieldname'    => '_bbp_topic_id'
     155        );
     156
     157        // Topic reply count (Stored in postmeta)
     158        $this->field_map[] = array(
     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',
     181            'callback_method' => 'callback_forumid'
     182        );
     183
     184        // Topic author.
     185        $this->field_map[] = array(
     186            'from_tablename'  => 'topics_table',
     187            'from_fieldname'  => 'the_topic_author_id',
     188            'to_type'         => 'topic',
     189            'to_fieldname'    => 'post_author',
     190            'callback_method' => 'callback_userid'
     191        );
     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
     210        // Topic title.
     211        $this->field_map[] = array(
     212            'from_tablename'  => 'topics_table',
     213            'from_fieldname'  => 'the_topic_title',
     214            'to_type'         => 'topic',
     215            'to_fieldname'    => 'post_title'
     216        );
     217
     218        // Topic slug (Clean name to avoid conflicts)
     219        $this->field_map[] = array(
     220            'from_tablename'  => 'topics_table',
     221            'from_fieldname'  => 'the_topic_slug',
     222            'to_type'         => 'topic',
     223            'to_fieldname'    => 'post_name',
     224            'callback_method' => 'callback_slug'
     225        );
     226
     227        // Topic parent forum id (If no parent, then 0)
     228        $this->field_map[] = array(
     229            'from_tablename'  => 'topics_table',
     230            'from_fieldname'  => 'the_topic_parent_forum_id',
     231            'to_type'         => 'topic',
     232            'to_fieldname'    => 'post_parent',
     233            'callback_method' => 'callback_forumid'
     234        );
     235
     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        );
     244        $this->field_map[] = array(
     245            'from_tablename'  => 'topics_table',
     246            'from_fieldname'  => 'the_topic_creation_date',
     247            'to_type'         => 'topic',
     248            'to_fieldname'    => 'post_date_gmt',
     249            'callback_method' => 'callback_datetime'
     250        );
     251        $this->field_map[] = array(
     252            'from_tablename'  => 'topics_table',
     253            'from_fieldname'  => 'the_topic_modified_date',
     254            'to_type'         => 'topic',
     255            'to_fieldname'    => 'post_modified',
     256            'callback_method' => 'callback_datetime'
     257        );
     258        $this->field_map[] = array(
     259            'from_tablename'  => 'topics_table',
     260            'from_fieldname'  => 'the_topic_modified_date',
     261            'to_type'         => 'topic',
     262            'to_fieldname'    => 'post_modified_gmt',
     263            'callback_method' => 'callback_datetime'
     264        );
     265        $this->field_map[] = array(
     266            'from_tablename'  => 'topics_table',
     267            'from_fieldname'  => 'the_topic_modified_date',
     268            'to_type'         => 'topic',
     269            'to_fieldname'    => '_bbp_last_active_time',
     270            'callback_method' => 'callback_datetime'
     271        );
     272
     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
     284        /** Tags Section ******************************************************/
     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
     298        // Topic id.
     299        $this->field_map[] = array(
     300            'from_tablename'  => 'tagcontent_table',
     301            'from_fieldname'  => 'contentid',
     302            'to_type'         => 'tags',
     303            'to_fieldname'    => 'objectid',
     304            'callback_method' => 'callback_topicid'
     305        );
     306
     307        // Taxonomy ID.
     308        $this->field_map[] = array(
     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 *****************************************************/
     324
     325        // Setup table joins for the reply section at the base of this section
     326
     327        // Reply id (Stored in postmeta)
     328        $this->field_map[] = array(
     329            'from_tablename'  => 'replies_table',
     330            'from_fieldname'  => 'the_reply_id',
     331            'to_type'         => 'reply',
     332            'to_fieldname'    => '_bbp_post_id'
     333        );
     334
     335        // Reply parent forum id (If no parent, then 0. Stored in postmeta)
     336        $this->field_map[] = array(
     337            'from_tablename'  => 'replies_table',
     338            'from_fieldname'  => 'the_reply_parent_forum_id',
     339            'to_type'         => 'reply',
     340            'to_fieldname'    => '_bbp_forum_id',
     341            'callback_method' => 'callback_topicid_to_forumid'
     342        );
     343
     344        // Reply parent topic id (If no parent, then 0. Stored in postmeta)
     345        $this->field_map[] = array(
     346            'from_tablename'  => 'replies_table',
     347            'from_fieldname'  => 'the_reply_parent_topic_id',
     348            'to_type'         => 'reply',
     349            'to_fieldname'    => '_bbp_topic_id',
     350            'callback_method' => 'callback_topicid'
     351        );
     352
     353        // Reply author ip (Stored in postmeta)
     354        $this->field_map[] = array(
     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.
     362        $this->field_map[] = array(
     363            'from_tablename'  => 'replies_table',
     364            'from_fieldname'  => 'the_reply_author_id',
     365            'to_type'         => 'reply',
     366            'to_fieldname'    => 'post_author',
     367            'callback_method' => 'callback_userid'
     368        );
     369
     370        // Reply title.
     371        $this->field_map[] = array(
     372            'from_tablename'  => 'replies_table',
     373            'from_fieldname'  => 'the_reply_title',
     374            'to_type'         => 'reply',
     375            'to_fieldname'    => 'post_title'
     376        );
     377
     378        // Reply slug (Clean name to avoid conflicts)
     379        $this->field_map[] = array(
     380            'from_tablename'  => 'replies_table',
     381            'from_fieldname'  => 'the_reply_slug',
     382            'to_type'         => 'reply',
     383            'to_fieldname'    => 'post_name',
     384            'callback_method' => 'callback_slug'
     385        );
     386
     387        // Reply content.
     388        $this->field_map[] = array(
     389            'from_tablename'  => 'replies_table',
     390            'from_fieldname'  => 'the_reply_content',
     391            'to_type'         => 'reply',
     392            'to_fieldname'    => 'post_content',
     393            'callback_method' => 'callback_html'
     394        );
     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)
     405        $this->field_map[] = array(
     406            'from_tablename'  => 'replies_table',
     407            'from_fieldname'  => 'the_reply_parent_topic_id',
     408            'to_type'         => 'reply',
     409            'to_fieldname'    => 'post_parent',
     410            'callback_method' => 'callback_topicid'
     411        );
     412
     413        // Reply dates.
     414        $this->field_map[] = array(
     415            'from_tablename'  => 'replies_table',
     416            'from_fieldname'  => 'the_reply_creation_date',
     417            'to_type'         => 'reply',
     418            'to_fieldname'    => 'post_date',
     419            'callback_method' => 'callback_datetime'
     420        );
     421        $this->field_map[] = array(
     422            'from_tablename'  => 'replies_table',
     423            'from_fieldname'  => 'the_reply_creation_date',
     424            'to_type'         => 'reply',
     425            'to_fieldname'    => 'post_date_gmt',
     426            'callback_method' => 'callback_datetime'
     427        );
     428        $this->field_map[] = array(
     429            'from_tablename'  => 'replies_table',
     430            'from_fieldname'  => 'the_reply_modified_date',
     431            'to_type'         => 'reply',
     432            'to_fieldname'    => 'post_modified',
     433            'callback_method' => 'callback_datetime'
     434        );
     435        $this->field_map[] = array(
     436            'from_tablename'  => 'replies_table',
     437            'from_fieldname'  => 'the_reply_modified_date',
     438            'to_type'         => 'reply',
     439            'to_fieldname'    => 'post_modified_gmt',
     440            'callback_method' => 'callback_datetime'
     441        );
     442
     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
     454        /** User Section ******************************************************/
     455
     456        // Setup table joins for the user section at the base of this section
    23457       
    24         // Forum parent id.  If no parent, than 0. Stored in postmeta.
    25         $this->field_map[] = array(
    26             'from_tablename' => 'forum', 'from_fieldname' => 'parentid',
    27             'to_type' => 'forum', 'to_fieldname' => '_bbp_parent_id'
    28         );
    29        
    30         // Forum title.
    31         $this->field_map[] = array(
    32             'from_tablename' => 'forum', 'from_fieldname' => 'title',
    33             'to_type' => 'forum', 'to_fieldname' => 'post_title'
    34         );
    35        
    36         // Forum slug. Clean name.
    37         $this->field_map[] = array(
    38             'from_tablename' => 'forum', 'from_fieldname' => 'title_clean',
    39             'to_type' => 'forum', 'to_fieldname' => 'post_name',
    40             'callback_method' => 'callback_slug'
    41         );
    42        
    43         // Forum description.
    44         $this->field_map[] = array(
    45             'from_tablename' => 'forum', 'from_fieldname' => 'description',
    46             'to_type' => 'forum', 'to_fieldname' => 'post_content',
    47             'callback_method' => 'callback_null'
    48         );
    49        
    50         // Forum display order.  Starts from 1.
    51         $this->field_map[] = array(
    52             'from_tablename' => 'forum', 'from_fieldname' => 'displayorder',
    53             'to_type' => 'forum', 'to_fieldname' => 'menu_order'
    54         );
    55        
    56         // Forum date update.
    57         $this->field_map[] = array(
    58             'to_type' => 'forum', 'to_fieldname' => 'post_date',
    59             'default' => date('Y-m-d H:i:s')
    60         );
    61         $this->field_map[] = array(
    62             'to_type' => 'forum', 'to_fieldname' => 'post_date_gmt',
    63             'default' => date('Y-m-d H:i:s')
    64         );
    65         $this->field_map[] = array(
    66             'to_type' => 'forum', 'to_fieldname' => 'post_modified',
    67             'default' => date('Y-m-d H:i:s')
    68         );
    69         $this->field_map[] = array(
    70             'to_type' => 'forum', 'to_fieldname' => 'post_modified_gmt',
    71             'default' => date('Y-m-d H:i:s')
    72         );
    73 
    74         /** Topic Section ******************************************************/
    75 
    76         // Topic id. Stored in postmeta.
    77         $this->field_map[] = array(
    78             'from_tablename' => 'thread', 'from_fieldname' => 'threadid',
    79             'to_type' => 'topic', 'to_fieldname' => '_bbp_topic_id'
    80         );
    81        
    82         // Forum id. Stored in postmeta.
    83         $this->field_map[] = array(
    84             'from_tablename' => 'thread', 'from_fieldname' => 'forumid',
    85             'to_type' => 'topic', 'to_fieldname' => '_bbp_forum_id',
    86             'callback_method' => 'callback_forumid'
    87         );
    88                
    89         // Topic author.
    90         $this->field_map[] = array(
    91             'from_tablename' => 'thread', 'from_fieldname' => 'postuserid',
    92             'to_type' => 'topic', 'to_fieldname' => 'post_author',
    93             'callback_method' => 'callback_userid'
    94         );
    95        
    96         // Topic title.
    97         $this->field_map[] = array(
    98             'from_tablename' => 'thread', 'from_fieldname' => 'title',
    99             'to_type' => 'topic', 'to_fieldname' => 'post_title'
    100         );
    101        
    102         // Topic slug. Clean name.
    103         $this->field_map[] = array(
    104             'from_tablename' => 'thread', 'from_fieldname' => 'title',
    105             'to_type' => 'topic', 'to_fieldname' => 'post_name',
    106             'callback_method' => 'callback_slug'
    107         );
    108        
    109         // Forum id.  If no parent, than 0.
    110         $this->field_map[] = array(
    111             'from_tablename' => 'thread', 'from_fieldname' => 'forumid',
    112             'to_type' => 'topic', 'to_fieldname' => 'post_parent',
    113             'callback_method' => 'callback_forumid'
    114         );
    115 
    116         // Topic date update.
    117         $this->field_map[] = array(
    118             'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    119             'to_type' => 'topic', 'to_fieldname' => 'post_date',
    120             'callback_method' => 'callback_datetime'
    121         );
    122         $this->field_map[] = array(
    123             'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    124             'to_type' => 'topic', 'to_fieldname' => 'post_date_gmt',
    125             'callback_method' => 'callback_datetime'
    126         );
    127         $this->field_map[] = array(
    128             'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    129             'to_type' => 'topic', 'to_fieldname' => 'post_modified',
    130             'callback_method' => 'callback_datetime'
    131         );
    132         $this->field_map[] = array(
    133             'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
    134             'to_type' => 'topic', 'to_fieldname' => 'post_modified_gmt',
    135             'callback_method' => 'callback_datetime'
    136         );
    137 
    138         /** Tags Section ******************************************************/
    139        
    140         // Topic id.
    141         $this->field_map[] = array(
    142             'from_tablename' => 'tagcontent', 'from_fieldname' => 'contentid',
    143             'to_type' => 'tags', 'to_fieldname' => 'objectid',
    144             'callback_method' => 'callback_topicid'
    145         );
    146        
    147         // Tags text.
    148         $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         );     
    153 
    154         /** Post Section ******************************************************/
    155 
    156         // Post id. Stores in postmeta.
    157         $this->field_map[] = array(
    158             'from_tablename' => 'post', 'from_fieldname' => 'postid',
    159             'to_type' => 'reply', 'to_fieldname' => '_bbp_post_id'
    160         );
    161        
    162         // Forum id. Stores in postmeta.
    163         $this->field_map[] = array(
    164             'from_tablename' => 'post', 'from_fieldname' => 'threadid',
    165             'to_type' => 'reply', 'to_fieldname' => '_bbp_forum_id',
    166             'callback_method' => 'callback_topicid_to_forumid'
    167         );
    168        
    169         // Topic id. Stores in postmeta.
    170         $this->field_map[] = array(
    171             'from_tablename' => 'post', 'from_fieldname' => 'threadid',
    172             'to_type' => 'reply', 'to_fieldname' => '_bbp_topic_id',
    173             'callback_method' => 'callback_topicid'
    174         );
    175        
    176         // Author ip.
    177         $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.
    183         $this->field_map[] = array(
    184             'from_tablename' => 'post', 'from_fieldname' => 'userid',
    185             'to_type' => 'reply', 'to_fieldname' => 'post_author',
    186             'callback_method' => 'callback_userid'
    187         );
    188        
    189         // Topic title.
    190         $this->field_map[] = array(
    191             'from_tablename' => 'post', 'from_fieldname' => 'title',
    192             'to_type' => 'reply', 'to_fieldname' => 'post_title'
    193         );
    194        
    195         // Topic slug. Clean name.
    196         $this->field_map[] = array(
    197             'from_tablename' => 'post', 'from_fieldname' => 'title',
    198             'to_type' => 'reply', 'to_fieldname' => 'post_name',
    199             'callback_method' => 'callback_slug'
    200         );
    201        
    202         // Post content.
    203         $this->field_map[] = array(
    204             'from_tablename' => 'post', 'from_fieldname' => 'pagetext',
    205             'to_type' => 'reply', 'to_fieldname' => 'post_content',
    206             'callback_method' => 'callback_html'
    207         );
    208        
    209         // Topic id.  If no parent, than 0.
    210         $this->field_map[] = array(
    211             'from_tablename' => 'post', 'from_fieldname' => 'threadid',
    212             'to_type' => 'reply', 'to_fieldname' => 'post_parent',
    213             'callback_method' => 'callback_topicid'
    214         );
    215 
    216         // Topic date update.
    217         $this->field_map[] = array(
    218             'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    219             'to_type' => 'reply', 'to_fieldname' => 'post_date',
    220             'callback_method' => 'callback_datetime'
    221         );
    222         $this->field_map[] = array(
    223             'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    224             'to_type' => 'reply', 'to_fieldname' => 'post_date_gmt',
    225             'callback_method' => 'callback_datetime'
    226         );
    227         $this->field_map[] = array(
    228             'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    229             'to_type' => 'reply', 'to_fieldname' => 'post_modified',
    230             'callback_method' => 'callback_datetime'
    231         );
    232         $this->field_map[] = array(
    233             'from_tablename' => 'post', 'from_fieldname' => 'dateline',
    234             'to_type' => 'reply', 'to_fieldname' => 'post_modified_gmt',
    235             'callback_method' => 'callback_datetime'
    236         );
    237 
    238         /** User Section ******************************************************/
    239 
    240         // Store old User id. Stores in usermeta.
    241         $this->field_map[] = array(
    242             'from_tablename' => 'user', 'from_fieldname' => 'userid',
    243             'to_type' => 'user', 'to_fieldname' => '_bbp_user_id'
    244         );
    245        
    246         // Store old User password. Stores in usermeta serialized with salt.
    247         $this->field_map[] = array(
    248             'from_tablename' => 'user', 'from_fieldname' => 'password',
    249             'to_type' => 'user', 'to_fieldname' => '_bbp_password',
     458        // Store old User id (Stored in usermeta)
     459        $this->field_map[] = array(
     460            'from_tablename'  => 'users_table',
     461            'from_fieldname'  => 'the_users_id',
     462            'to_type'         => 'user',
     463            'to_fieldname'    => '_bbp_user_id'
     464        );
     465
     466        // Store old User password (Stored in usermeta serialized with salt)
     467        $this->field_map[] = array(
     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
    254         $this->field_map[] = array(
    255             'from_tablename' => 'user', 'from_fieldname' => 'salt',
    256             'to_type' => 'user', 'to_fieldname' => ''
    257         );
    258                
    259         // User password verify class. Stores in usermeta for verifying password.
    260         $this->field_map[] = array(
    261             'to_type' => 'user', 'to_fieldname' => '_bbp_class',
    262             'default' => 'Vbulletin'
    263         );
    264        
     475        // Store old User Salt (This is only used for the SELECT row info for the above password save)
     476        $this->field_map[] = array(
     477            'from_tablename'  => 'users_table',
     478            'from_fieldname'  => 'the_users_password_salt',
     479            'to_type'         => 'user',
     480            'to_fieldname'    => ''
     481        );
     482
     483        // User password verify class (Stored in usermeta for verifying password)
     484        $this->field_map[] = array(
     485            'to_type'         => 'user',
     486            'to_fieldname'    => '_bbp_class',
     487            'default' => 'Example'
     488        );
     489
    265490        // User name.
    266491        $this->field_map[] = array(
    267             'from_tablename' => 'user', 'from_fieldname' => 'username',
    268             'to_type' => 'user', 'to_fieldname' => 'user_login'
    269         );
    270                
     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'
     504        );
     505
    271506        // User email.
    272507        $this->field_map[] = array(
    273             'from_tablename' => 'user', 'from_fieldname' => 'email',
    274             'to_type' => 'user', 'to_fieldname' => 'user_email'
    275         );
    276        
     508            'from_tablename'  => 'users_table',
     509            'from_fieldname'  => 'the_users_email_address',
     510            'to_type'         => 'user',
     511            'to_fieldname'    => 'user_email'
     512        );
     513
    277514        // User homepage.
    278515        $this->field_map[] = array(
    279             'from_tablename' => 'user', 'from_fieldname' => 'homepage',
    280             'to_type' => 'user', 'to_fieldname' => 'user_url'
    281         );
    282        
     516            'from_tablename'  => 'users_table',
     517            'from_fieldname'  => 'the_users_homepage_url',
     518            'to_type'         => 'user',
     519            'to_fieldname'    => 'user_url'
     520        );
     521
    283522        // User registered.
    284523        $this->field_map[] = array(
    285             'from_tablename' => 'user', 'from_fieldname' => 'joindate',
    286             'to_type' => 'user', 'to_fieldname' => 'user_registered',
    287             'callback_method' => 'callback_datetime'
    288         );
    289        
    290         // User aim.
    291         $this->field_map[] = array(
    292             'from_tablename' => 'user', 'from_fieldname' => 'aim',
    293             'to_type' => 'user', 'to_fieldname' => 'aim'
    294         );
    295        
    296         // User yahoo.
    297         $this->field_map[] = array(
    298             'from_tablename' => 'user', 'from_fieldname' => 'yahoo',
    299             'to_type' => 'user', 'to_fieldname' => 'yim'
    300         ); 
     524            'from_tablename'  => 'users_table',
     525            'from_fieldname'  => 'the_users_registration_date',
     526            'to_type'         => 'user',
     527            'to_fieldname'    => 'user_registered',
     528            'callback_method' => 'callback_datetime'
     529        );
     530
     531        // User status.
     532        $this->field_map[] = array(
     533            'from_tablename' => 'users_table',
     534            'from_fieldname' => 'the_users_status',
     535            'to_type'        => 'user',
     536            'to_fieldname'   => 'user_status'
     537        );
     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
     572        $this->field_map[] = array(
     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.
    306586     */
    307     public function info()
    308     {
     587    public function info() {
    309588        return '';
    310589    }
     
    315594     * as one value. Array values are auto sanitized by WordPress.
    316595     */
    317     public function callback_savepass( $field, $row )
    318     {
     596    public function callback_savepass( $field, $row ) {
    319597        $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] );
    320598        return $pass_array;
     
    325603     * to a pass the user has typed in.
    326604     */
    327     public function authenticate_pass( $password, $serialized_pass )
    328     {
     605    public function authenticate_pass( $password, $serialized_pass ) {
    329606        $pass_array = unserialize( $serialized_pass );
    330607        return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
Note: See TracChangeset for help on using the changeset viewer.