PluginProbe
bbPress / 2.6.6
bbPress v2.6.6
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
← All changes | includes/admin/converters/Example.php +547 -168 2.2.12.6.6 View file →
@@ -1,312 +1,693 @@
1 1 <?php
2 2
3 3 /**
4 - * Implementation of Example converter.
4 + * bbPress Example Converter
5 + *
6 + * @package bbPress
7 + * @subpackage Converters
5 8 */
6 -class Example_Converter extends BBP_Converter_Base
7 -{
8 - function __construct()
9 - {
9 +
10 +/**
11 + * Example converter base impoprter template for bbPress
12 + *
13 + * @since 2.3.0 bbPress (r4689)
14 + *
15 + * @link Codex Docs https://codex.bbpress.org/import-forums/custom-import
16 + */
17 +class Example extends BBP_Converter_Base {
18 +
19 + /**
20 + * Main Constructor
21 + */
22 + public function __construct() {
10 23 parent::__construct();
11 - $this->setup_globals();
12 24 }
13 25
14 - public function setup_globals()
15 - {
16 - /** Forum Section ******************************************************/
26 + /**
27 + * Sets up the field mappings
28 + */
29 + public function setup_globals() {
17 30
18 - // Forum id. Stored in postmeta.
31 + /** Forum Section *****************************************************/
32 +
33 + // Setup table joins for the forum section at the base of this section
34 +
35 + // Old forum id (Stored in postmeta)
19 36 $this->field_map[] = array(
20 - 'from_tablename' => 'forum', 'from_fieldname' => 'forumid',
21 - 'to_type' => 'forum', 'to_fieldname' => '_bbp_forum_id'
37 + 'from_tablename' => 'forums_table',
38 + 'from_fieldname' => 'the_forum_id',
39 + 'to_type' => 'forum',
40 + 'to_fieldname' => '_bbp_old_forum_id'
22 41 );
23 -
24 - // Forum parent id. If no parent, than 0. Stored in postmeta.
42 +
43 + // Forum parent id (If no parent, then 0. Stored in postmeta)
25 44 $this->field_map[] = array(
26 - 'from_tablename' => 'forum', 'from_fieldname' => 'parentid',
27 - 'to_type' => 'forum', 'to_fieldname' => '_bbp_parent_id'
45 + 'from_tablename' => 'forums_table',
46 + 'from_fieldname' => 'the_parent_id',
47 + 'to_type' => 'forum',
48 + 'to_fieldname' => '_bbp_old_forum_parent_id'
28 49 );
29 -
50 +
51 + // Forum topic count (Stored in postmeta)
52 + $this->field_map[] = array(
53 + 'from_tablename' => 'forums_table',
54 + 'from_fieldname' => 'the_topic_count',
55 + 'to_type' => 'forum',
56 + 'to_fieldname' => '_bbp_topic_count'
57 + );
58 +
59 + // Forum reply count (Stored in postmeta)
60 + $this->field_map[] = array(
61 + 'from_tablename' => 'forums_table',
62 + 'from_fieldname' => 'the_reply_count',
63 + 'to_type' => 'forum',
64 + 'to_fieldname' => '_bbp_reply_count'
65 + );
66 +
67 + // Forum total topic count (Stored in postmeta)
68 + $this->field_map[] = array(
69 + 'from_tablename' => 'forums_table',
70 + 'from_fieldname' => 'the_total_topic_count',
71 + 'to_type' => 'forum',
72 + 'to_fieldname' => '_bbp_total_topic_count'
73 + );
74 +
75 + // Forum total reply count (Stored in postmeta)
76 + $this->field_map[] = array(
77 + 'from_tablename' => 'forums_table',
78 + 'from_fieldname' => 'the_total_reply_count',
79 + 'to_type' => 'forum',
80 + 'to_fieldname' => '_bbp_total_reply_count'
81 + );
82 +
30 83 // Forum title.
31 84 $this->field_map[] = array(
32 - 'from_tablename' => 'forum', 'from_fieldname' => 'title',
33 - 'to_type' => 'forum', 'to_fieldname' => 'post_title'
85 + 'from_tablename' => 'forums_table',
86 + 'from_fieldname' => 'the_forum_title',
87 + 'to_type' => 'forum',
88 + 'to_fieldname' => 'post_title'
34 89 );
35 -
36 - // Forum slug. Clean name.
90 +
91 + // Forum slug (Clean name to avoid confilcts)
37 92 $this->field_map[] = array(
38 - 'from_tablename' => 'forum', 'from_fieldname' => 'title_clean',
39 - 'to_type' => 'forum', 'to_fieldname' => 'post_name',
93 + 'from_tablename' => 'forums_table',
94 + 'from_fieldname' => 'the_forum_slug',
95 + 'to_type' => 'forum',
96 + 'to_fieldname' => 'post_name',
40 97 'callback_method' => 'callback_slug'
41 98 );
42 -
99 +
43 100 // Forum description.
44 101 $this->field_map[] = array(
45 - 'from_tablename' => 'forum', 'from_fieldname' => 'description',
46 - 'to_type' => 'forum', 'to_fieldname' => 'post_content',
102 + 'from_tablename' => 'forums_table',
103 + 'from_fieldname' => 'the_forum_description',
104 + 'to_type' => 'forum',
105 + 'to_fieldname' => 'post_content',
47 106 'callback_method' => 'callback_null'
48 107 );
49 -
50 - // Forum display order. Starts from 1.
108 +
109 + // Forum display order (Starts from 1)
51 110 $this->field_map[] = array(
52 - 'from_tablename' => 'forum', 'from_fieldname' => 'displayorder',
53 - 'to_type' => 'forum', 'to_fieldname' => 'menu_order'
111 + 'from_tablename' => 'forums_table',
112 + 'from_fieldname' => 'the_forum_order',
113 + 'to_type' => 'forum',
114 + 'to_fieldname' => 'menu_order'
54 115 );
55 -
56 - // Forum date update.
116 +
117 + // Forum type (Category = 0 or Forum = 1, Stored in postmeta)
57 118 $this->field_map[] = array(
58 - 'to_type' => 'forum', 'to_fieldname' => 'post_date',
119 + 'from_tablename' => 'forums_table',
120 + 'from_fieldname' => 'the_forum_type',
121 + 'to_type' => 'forum',
122 + 'to_fieldname' => '_bbp_forum_type',
123 + 'callback_method' => 'callback_forum_type'
124 + );
125 +
126 + // Forum status (Unlocked = 0 or Locked = 1, Stored in postmeta)
127 + $this->field_map[] = array(
128 + 'from_tablename' => 'forums_table',
129 + 'from_fieldname' => 'the_forum_status',
130 + 'to_type' => 'forum',
131 + 'to_fieldname' => '_bbp_status',
132 + 'callback_method' => 'callback_forum_status'
133 + );
134 +
135 + // Forum dates.
136 + $this->field_map[] = array(
137 + 'to_type' => 'forum',
138 + 'to_fieldname' => 'post_date',
59 139 'default' => date('Y-m-d H:i:s')
60 140 );
61 141 $this->field_map[] = array(
62 - 'to_type' => 'forum', 'to_fieldname' => 'post_date_gmt',
142 + 'to_type' => 'forum',
143 + 'to_fieldname' => 'post_date_gmt',
63 144 'default' => date('Y-m-d H:i:s')
64 145 );
65 146 $this->field_map[] = array(
66 - 'to_type' => 'forum', 'to_fieldname' => 'post_modified',
147 + 'to_type' => 'forum',
148 + 'to_fieldname' => 'post_modified',
67 149 'default' => date('Y-m-d H:i:s')
68 150 );
69 151 $this->field_map[] = array(
70 - 'to_type' => 'forum', 'to_fieldname' => 'post_modified_gmt',
152 + 'to_type' => 'forum',
153 + 'to_fieldname' => 'post_modified_gmt',
71 154 'default' => date('Y-m-d H:i:s')
72 155 );
73 156
74 - /** Topic Section ******************************************************/
157 + // Setup the table joins for the forum section
158 + $this->field_map[] = array(
159 + 'from_tablename' => 'groups_table',
160 + 'from_fieldname' => 'forum_id',
161 + 'join_tablename' => 'forums_table',
162 + 'join_type' => 'INNER',
163 + 'join_expression' => 'USING groups_table.forum_id = forums_table.forum_id',
164 + // 'from_expression' => 'WHERE forums_table.forum_id != 1',
165 + 'to_type' => 'forum'
166 + );
75 167
76 - // Topic id. Stored in postmeta.
168 + /** Forum Subscriptions Section ***************************************/
169 +
170 + // Subscribed forum ID (Stored in usermeta)
77 171 $this->field_map[] = array(
78 - 'from_tablename' => 'thread', 'from_fieldname' => 'threadid',
79 - 'to_type' => 'topic', 'to_fieldname' => '_bbp_topic_id'
172 + 'from_tablename' => 'forum_subscriptions_table',
173 + 'from_fieldname' => 'the_forum_id',
174 + 'to_type' => 'forum_subscriptions',
175 + 'to_fieldname' => '_bbp_forum_subscriptions'
80 176 );
81 -
82 - // Forum id. Stored in postmeta.
177 +
178 + // Subscribed user ID (Stored in usermeta)
83 179 $this->field_map[] = array(
84 - 'from_tablename' => 'thread', 'from_fieldname' => 'forumid',
85 - 'to_type' => 'topic', 'to_fieldname' => '_bbp_forum_id',
180 + 'from_tablename' => 'forum_subscriptions_table',
181 + 'from_fieldname' => 'the_user_id',
182 + 'to_type' => 'forum_subscriptions',
183 + 'to_fieldname' => 'user_id',
184 + 'callback_method' => 'callback_userid'
185 + );
186 +
187 + /** Topic Section *****************************************************/
188 +
189 + // Setup table joins for the topic section at the base of this section
190 +
191 + // Old topic id (Stored in postmeta)
192 + $this->field_map[] = array(
193 + 'from_tablename' => 'topics_table',
194 + 'from_fieldname' => 'the_topic_id',
195 + 'to_type' => 'topic',
196 + 'to_fieldname' => '_bbp_old_topic_id'
197 + );
198 +
199 + // Topic reply count (Stored in postmeta)
200 + $this->field_map[] = array(
201 + 'from_tablename' => 'topics_table',
202 + 'from_fieldname' => 'the_topic_reply_count',
203 + 'to_type' => 'topic',
204 + 'to_fieldname' => '_bbp_reply_count',
205 + 'callback_method' => 'callback_topic_reply_count'
206 + );
207 +
208 + // Topic total reply count (Stored in postmeta)
209 + $this->field_map[] = array(
210 + 'from_tablename' => 'topics_table',
211 + 'from_fieldname' => 'the_total_topic_reply_count',
212 + 'to_type' => 'topic',
213 + 'to_fieldname' => '_bbp_total_reply_count',
214 + 'callback_method' => 'callback_topic_reply_count'
215 + );
216 +
217 + // Topic parent forum id (If no parent, then 0. Stored in postmeta)
218 + $this->field_map[] = array(
219 + 'from_tablename' => 'topics_table',
220 + 'from_fieldname' => 'the_topic_parent_forum_id',
221 + 'to_type' => 'topic',
222 + 'to_fieldname' => '_bbp_forum_id',
86 223 'callback_method' => 'callback_forumid'
87 224 );
88 -
225 +
89 226 // Topic author.
90 227 $this->field_map[] = array(
91 - 'from_tablename' => 'thread', 'from_fieldname' => 'postuserid',
92 - 'to_type' => 'topic', 'to_fieldname' => 'post_author',
228 + 'from_tablename' => 'topics_table',
229 + 'from_fieldname' => 'the_topic_author_id',
230 + 'to_type' => 'topic',
231 + 'to_fieldname' => 'post_author',
93 232 'callback_method' => 'callback_userid'
94 233 );
95 -
234 +
235 + // Topic author ip (Stored in postmeta)
236 + $this->field_map[] = array(
237 + 'from_tablename' => 'topics_table',
238 + 'from_fieldname' => 'the_topic_author_ip_address',
239 + 'to_type' => 'topic',
240 + 'to_fieldname' => '_bbp_author_ip'
241 + );
242 +
243 + // Topic content.
244 + $this->field_map[] = array(
245 + 'from_tablename' => 'topics_table',
246 + 'from_fieldname' => 'the_topic_content',
247 + 'to_type' => 'topic',
248 + 'to_fieldname' => 'post_content',
249 + 'callback_method' => 'callback_html'
250 + );
251 +
96 252 // Topic title.
97 253 $this->field_map[] = array(
98 - 'from_tablename' => 'thread', 'from_fieldname' => 'title',
99 - 'to_type' => 'topic', 'to_fieldname' => 'post_title'
254 + 'from_tablename' => 'topics_table',
255 + 'from_fieldname' => 'the_topic_title',
256 + 'to_type' => 'topic',
257 + 'to_fieldname' => 'post_title'
100 258 );
101 -
102 - // Topic slug. Clean name.
259 +
260 + // Topic slug (Clean name to avoid conflicts)
103 261 $this->field_map[] = array(
104 - 'from_tablename' => 'thread', 'from_fieldname' => 'title',
105 - 'to_type' => 'topic', 'to_fieldname' => 'post_name',
262 + 'from_tablename' => 'topics_table',
263 + 'from_fieldname' => 'the_topic_slug',
264 + 'to_type' => 'topic',
265 + 'to_fieldname' => 'post_name',
106 266 'callback_method' => 'callback_slug'
107 267 );
108 -
109 - // Forum id. If no parent, than 0.
268 +
269 + // Topic status (Open or Closed)
110 270 $this->field_map[] = array(
111 - 'from_tablename' => 'thread', 'from_fieldname' => 'forumid',
112 - 'to_type' => 'topic', 'to_fieldname' => 'post_parent',
271 + 'from_tablename' => 'topics_table',
272 + 'from_fieldname' => 'the_topic_status',
273 + 'to_type' => 'topic',
274 + 'to_fieldname' => '_bbp_old_closed_status_id',
275 + 'callback_method' => 'callback_topic_status'
276 + );
277 +
278 + // Topic parent forum id (If no parent, then 0)
279 + $this->field_map[] = array(
280 + 'from_tablename' => 'topics_table',
281 + 'from_fieldname' => 'the_topic_parent_forum_id',
282 + 'to_type' => 'topic',
283 + 'to_fieldname' => 'post_parent',
113 284 'callback_method' => 'callback_forumid'
114 285 );
115 286
116 - // Topic date update.
287 + // Sticky status (Stored in postmeta)
117 288 $this->field_map[] = array(
118 - 'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
119 - 'to_type' => 'topic', 'to_fieldname' => 'post_date',
289 + 'from_tablename' => 'topics_table',
290 + 'from_fieldname' => 'the_topic_sticky_status',
291 + 'to_type' => 'topic',
292 + 'to_fieldname' => '_bbp_old_sticky_status_id',
293 + 'callback_method' => 'callback_sticky_status'
294 + );
295 +
296 + // Topic dates.
297 + $this->field_map[] = array(
298 + 'from_tablename' => 'topics_table',
299 + 'from_fieldname' => 'the_topic_creation_date',
300 + 'to_type' => 'topic',
301 + 'to_fieldname' => 'post_date',
120 302 'callback_method' => 'callback_datetime'
121 303 );
122 304 $this->field_map[] = array(
123 - 'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
124 - 'to_type' => 'topic', 'to_fieldname' => 'post_date_gmt',
305 + 'from_tablename' => 'topics_table',
306 + 'from_fieldname' => 'the_topic_creation_date',
307 + 'to_type' => 'topic',
308 + 'to_fieldname' => 'post_date_gmt',
125 309 'callback_method' => 'callback_datetime'
126 310 );
127 311 $this->field_map[] = array(
128 - 'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
129 - 'to_type' => 'topic', 'to_fieldname' => 'post_modified',
312 + 'from_tablename' => 'topics_table',
313 + 'from_fieldname' => 'the_topic_modified_date',
314 + 'to_type' => 'topic',
315 + 'to_fieldname' => 'post_modified',
130 316 'callback_method' => 'callback_datetime'
131 317 );
132 318 $this->field_map[] = array(
133 - 'from_tablename' => 'thread', 'from_fieldname' => 'dateline',
134 - 'to_type' => 'topic', 'to_fieldname' => 'post_modified_gmt',
319 + 'from_tablename' => 'topics_table',
320 + 'from_fieldname' => 'the_topic_modified_date',
321 + 'to_type' => 'topic',
322 + 'to_fieldname' => 'post_modified_gmt',
135 323 'callback_method' => 'callback_datetime'
136 324 );
325 + $this->field_map[] = array(
326 + 'from_tablename' => 'topics_table',
327 + 'from_fieldname' => 'the_topic_modified_date',
328 + 'to_type' => 'topic',
329 + 'to_fieldname' => '_bbp_last_active_time',
330 + 'callback_method' => 'callback_datetime'
331 + );
137 332
333 + // Setup any table joins needed for the topic section
334 + $this->field_map[] = array(
335 + 'from_tablename' => 'replies_table',
336 + 'from_fieldname' => 'the_topic_id',
337 + 'join_tablename' => 'topics_table',
338 + 'join_type' => 'INNER',
339 + 'join_expression' => 'USING replies_table.the_topic_id = topics_table.the_topic_id',
340 + 'from_expression' => 'WHERE forums_table.the_topic_id = 0',
341 + 'to_type' => 'topic'
342 + );
343 +
138 344 /** Tags Section ******************************************************/
139 -
345 +
346 + // Setup table joins for the tag section at the base of this section
347 + // Setup any table joins needed for the tags section
348 + $this->field_map[] = array(
349 + 'from_tablename' => 'tag_table',
350 + 'from_fieldname' => 'the_topic_id',
351 + 'join_tablename' => 'tagcontent_table',
352 + 'join_type' => 'INNER',
353 + 'join_expression' => 'USING tagcontent_table.tag_id = tags_table.tag_id',
354 + 'from_expression' => 'WHERE tagcontent_table.tag_id = tag_table.tag_id',
355 + 'to_type' => 'tags'
356 + );
357 +
140 358 // Topic id.
141 359 $this->field_map[] = array(
142 - 'from_tablename' => 'tagcontent', 'from_fieldname' => 'contentid',
143 - 'to_type' => 'tags', 'to_fieldname' => 'objectid',
360 + 'from_tablename' => 'tagcontent_table',
361 + 'from_fieldname' => 'contentid',
362 + 'to_type' => 'tags',
363 + 'to_fieldname' => 'objectid',
144 364 'callback_method' => 'callback_topicid'
145 365 );
146 -
147 - // Tags text.
366 +
367 + // Taxonomy ID.
148 368 $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 - );
369 + 'from_tablename' => 'tagcontent_table',
370 + 'from_fieldname' => 'tagid',
371 + 'to_type' => 'tags',
372 + 'to_fieldname' => 'taxonomy'
373 + );
153 374
154 - /** Post Section ******************************************************/
375 + // Term text.
376 + $this->field_map[] = array(
377 + 'from_tablename' => 'tag_table',
378 + 'from_fieldname' => 'tagtext',
379 + 'to_type' => 'tags',
380 + 'to_fieldname' => 'name'
381 + );
155 382
156 - // Post id. Stores in postmeta.
383 + // Term slug.
157 384 $this->field_map[] = array(
158 - 'from_tablename' => 'post', 'from_fieldname' => 'postid',
159 - 'to_type' => 'reply', 'to_fieldname' => '_bbp_post_id'
385 + 'from_tablename' => 'tag_table',
386 + 'from_fieldname' => 'tagslug',
387 + 'to_type' => 'tags',
388 + 'to_fieldname' => 'slug',
389 + 'callback_method' => 'callback_slug'
160 390 );
161 -
162 - // Forum id. Stores in postmeta.
391 +
392 + // Term description.
163 393 $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'
394 + 'from_tablename' => 'tag_table',
395 + 'from_fieldname' => 'tagdescription',
396 + 'to_type' => 'tags',
397 + 'to_fieldname' => 'description'
167 398 );
168 -
169 - // Topic id. Stores in postmeta.
399 +
400 + /** Topic Subscriptions Section ***************************************/
401 +
402 + // Subscribed topic ID (Stored in usermeta)
170 403 $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'
404 + 'from_tablename' => 'topic_subscriptions_table',
405 + 'from_fieldname' => 'the_topic_id',
406 + 'to_type' => 'topic_subscriptions',
407 + 'to_fieldname' => '_bbp_subscriptions'
174 408 );
175 -
176 - // Author ip.
409 +
410 + // Subscribed user ID (Stored in usermeta)
177 411 $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.
412 + 'from_tablename' => 'topic_subscriptions_table',
413 + 'from_fieldname' => 'the_user_id',
414 + 'to_type' => 'topic_subscriptions',
415 + 'to_fieldname' => 'user_id',
416 + 'callback_method' => 'callback_userid'
417 + );
418 +
419 + /** Favorites Section *************************************************/
420 +
421 + // Favorited topic ID (Stored in usermeta)
183 422 $this->field_map[] = array(
184 - 'from_tablename' => 'post', 'from_fieldname' => 'userid',
185 - 'to_type' => 'reply', 'to_fieldname' => 'post_author',
423 + 'from_tablename' => 'favorites_table',
424 + 'from_fieldname' => 'the_favorite_topic_id',
425 + 'to_type' => 'favorites',
426 + 'to_fieldname' => '_bbp_favorites'
427 + );
428 +
429 + // Favorited user ID (Stored in usermeta)
430 + $this->field_map[] = array(
431 + 'from_tablename' => 'favorites_table',
432 + 'from_fieldname' => 'the_user_id',
433 + 'to_type' => 'favorites',
434 + 'to_fieldname' => 'user_id',
186 435 'callback_method' => 'callback_userid'
187 436 );
188 -
189 - // Topic title.
437 +
438 + /** Reply Section *****************************************************/
439 +
440 + // Setup table joins for the reply section at the base of this section
441 +
442 + // Old reply id (Stored in postmeta)
190 443 $this->field_map[] = array(
191 - 'from_tablename' => 'post', 'from_fieldname' => 'title',
192 - 'to_type' => 'reply', 'to_fieldname' => 'post_title'
444 + 'from_tablename' => 'replies_table',
445 + 'from_fieldname' => 'the_reply_id',
446 + 'to_type' => 'reply',
447 + 'to_fieldname' => '_bbp_old_reply_id'
193 448 );
194 -
195 - // Topic slug. Clean name.
449 +
450 + // Reply parent forum id (If no parent, then 0. Stored in postmeta)
196 451 $this->field_map[] = array(
197 - 'from_tablename' => 'post', 'from_fieldname' => 'title',
198 - 'to_type' => 'reply', 'to_fieldname' => 'post_name',
199 - 'callback_method' => 'callback_slug'
452 + 'from_tablename' => 'replies_table',
453 + 'from_fieldname' => 'the_reply_parent_forum_id',
454 + 'to_type' => 'reply',
455 + 'to_fieldname' => '_bbp_forum_id',
456 + 'callback_method' => 'callback_forumid'
200 457 );
201 -
202 - // Post content.
458 +
459 + // Reply parent topic id (If no parent, then 0. Stored in postmeta)
203 460 $this->field_map[] = array(
204 - 'from_tablename' => 'post', 'from_fieldname' => 'pagetext',
205 - 'to_type' => 'reply', 'to_fieldname' => 'post_content',
461 + 'from_tablename' => 'replies_table',
462 + 'from_fieldname' => 'the_reply_parent_topic_id',
463 + 'to_type' => 'reply',
464 + 'to_fieldname' => '_bbp_topic_id',
465 + 'callback_method' => 'callback_topicid'
466 + );
467 +
468 + // Reply author ip (Stored in postmeta)
469 + $this->field_map[] = array(
470 + 'from_tablename' => 'replies_table',
471 + 'from_fieldname' => 'the_reply_author_ip_address',
472 + 'to_type' => 'reply',
473 + 'to_fieldname' => '_bbp_author_ip'
474 + );
475 +
476 + // Reply author.
477 + $this->field_map[] = array(
478 + 'from_tablename' => 'replies_table',
479 + 'from_fieldname' => 'the_reply_author_id',
480 + 'to_type' => 'reply',
481 + 'to_fieldname' => 'post_author',
482 + 'callback_method' => 'callback_userid'
483 + );
484 +
485 + // Reply title and reply slugs
486 + // Note: We don't actually want either a reply title or a reply slug as
487 + // we want single replies to use their ID as the permalink.
488 +
489 + // Reply content.
490 + $this->field_map[] = array(
491 + 'from_tablename' => 'replies_table',
492 + 'from_fieldname' => 'the_reply_content',
493 + 'to_type' => 'reply',
494 + 'to_fieldname' => 'post_content',
206 495 'callback_method' => 'callback_html'
207 496 );
208 -
209 - // Topic id. If no parent, than 0.
497 +
498 + // Reply order.
210 499 $this->field_map[] = array(
211 - 'from_tablename' => 'post', 'from_fieldname' => 'threadid',
212 - 'to_type' => 'reply', 'to_fieldname' => 'post_parent',
500 + 'from_tablename' => 'replies_table',
501 + 'from_fieldname' => 'the_reply_order',
502 + 'to_type' => 'reply',
503 + 'to_fieldname' => 'menu_order'
504 + );
505 +
506 + // Reply parent topic id (If no parent, then 0)
507 + $this->field_map[] = array(
508 + 'from_tablename' => 'replies_table',
509 + 'from_fieldname' => 'the_reply_parent_topic_id',
510 + 'to_type' => 'reply',
511 + 'to_fieldname' => 'post_parent',
213 512 'callback_method' => 'callback_topicid'
214 513 );
215 514
216 - // Topic date update.
515 + // Reply dates.
217 516 $this->field_map[] = array(
218 - 'from_tablename' => 'post', 'from_fieldname' => 'dateline',
219 - 'to_type' => 'reply', 'to_fieldname' => 'post_date',
517 + 'from_tablename' => 'replies_table',
518 + 'from_fieldname' => 'the_reply_creation_date',
519 + 'to_type' => 'reply',
520 + 'to_fieldname' => 'post_date',
220 521 'callback_method' => 'callback_datetime'
221 522 );
222 523 $this->field_map[] = array(
223 - 'from_tablename' => 'post', 'from_fieldname' => 'dateline',
224 - 'to_type' => 'reply', 'to_fieldname' => 'post_date_gmt',
524 + 'from_tablename' => 'replies_table',
525 + 'from_fieldname' => 'the_reply_creation_date',
526 + 'to_type' => 'reply',
527 + 'to_fieldname' => 'post_date_gmt',
225 528 'callback_method' => 'callback_datetime'
226 529 );
227 530 $this->field_map[] = array(
228 - 'from_tablename' => 'post', 'from_fieldname' => 'dateline',
229 - 'to_type' => 'reply', 'to_fieldname' => 'post_modified',
531 + 'from_tablename' => 'replies_table',
532 + 'from_fieldname' => 'the_reply_modified_date',
533 + 'to_type' => 'reply',
534 + 'to_fieldname' => 'post_modified',
230 535 'callback_method' => 'callback_datetime'
231 536 );
232 537 $this->field_map[] = array(
233 - 'from_tablename' => 'post', 'from_fieldname' => 'dateline',
234 - 'to_type' => 'reply', 'to_fieldname' => 'post_modified_gmt',
538 + 'from_tablename' => 'replies_table',
539 + 'from_fieldname' => 'the_reply_modified_date',
540 + 'to_type' => 'reply',
541 + 'to_fieldname' => 'post_modified_gmt',
235 542 'callback_method' => 'callback_datetime'
236 543 );
237 544
545 + // Setup any table joins needed for the reply section
546 + $this->field_map[] = array(
547 + 'from_tablename' => 'topics_table',
548 + 'from_fieldname' => 'the_topic_id',
549 + 'join_tablename' => 'replies_table',
550 + 'join_type' => 'INNER',
551 + 'join_expression' => 'USING topics_table.the_topic_id = replies_table.the_topic_id',
552 + 'from_expression' => 'WHERE topics_table.first_post != 0',
553 + 'to_type' => 'reply'
554 + );
555 +
238 556 /** User Section ******************************************************/
239 557
240 - // Store old User id. Stores in usermeta.
558 + // Setup table joins for the user section at the base of this section
559 +
560 + // Store old user id (Stored in usermeta)
241 561 $this->field_map[] = array(
242 - 'from_tablename' => 'user', 'from_fieldname' => 'userid',
243 - 'to_type' => 'user', 'to_fieldname' => '_bbp_user_id'
562 + 'from_tablename' => 'users_table',
563 + 'from_fieldname' => 'the_users_id',
564 + 'to_type' => 'user',
565 + 'to_fieldname' => '_bbp_old_user_id'
244 566 );
245 -
246 - // Store old User password. Stores in usermeta serialized with salt.
567 +
568 + // Store old user password (Stored in usermeta serialized with salt)
247 569 $this->field_map[] = array(
248 - 'from_tablename' => 'user', 'from_fieldname' => 'password',
249 - 'to_type' => 'user', 'to_fieldname' => '_bbp_password',
570 + 'from_tablename' => 'users_table',
571 + 'from_fieldname' => 'the_users_password',
572 + 'to_type' => 'user',
573 + 'to_fieldname' => '_bbp_password',
250 574 'callback_method' => 'callback_savepass'
251 575 );
252 576
253 - // Store old User Salt. This is only used for the SELECT row info for the above password save
577 + // Store old user salt (This is only used for the SELECT row info for the above password save)
254 578 $this->field_map[] = array(
255 - 'from_tablename' => 'user', 'from_fieldname' => 'salt',
256 - 'to_type' => 'user', 'to_fieldname' => ''
579 + 'from_tablename' => 'users_table',
580 + 'from_fieldname' => 'the_users_password_salt',
581 + 'to_type' => 'user',
582 + 'to_fieldname' => ''
257 583 );
258 -
259 - // User password verify class. Stores in usermeta for verifying password.
584 +
585 + // User password verify class (Stored in usermeta for verifying password)
260 586 $this->field_map[] = array(
261 - 'to_type' => 'user', 'to_fieldname' => '_bbp_class',
262 - 'default' => 'Vbulletin'
587 + 'to_type' => 'user',
588 + 'to_fieldname' => '_bbp_class',
589 + 'default' => 'Example'
263 590 );
264 -
591 +
265 592 // User name.
266 593 $this->field_map[] = array(
267 - 'from_tablename' => 'user', 'from_fieldname' => 'username',
268 - 'to_type' => 'user', 'to_fieldname' => 'user_login'
594 + 'from_tablename' => 'users_table',
595 + 'from_fieldname' => 'the_users_username',
596 + 'to_type' => 'user',
597 + 'to_fieldname' => 'user_login'
269 598 );
270 -
599 +
600 + // User nice name.
601 + $this->field_map[] = array(
602 + 'from_tablename' => 'users_table',
603 + 'from_fieldname' => 'the_users_nicename',
604 + 'to_type' => 'user',
605 + 'to_fieldname' => 'user_nicename'
606 + );
607 +
271 608 // User email.
272 609 $this->field_map[] = array(
273 - 'from_tablename' => 'user', 'from_fieldname' => 'email',
274 - 'to_type' => 'user', 'to_fieldname' => 'user_email'
610 + 'from_tablename' => 'users_table',
611 + 'from_fieldname' => 'the_users_email_address',
612 + 'to_type' => 'user',
613 + 'to_fieldname' => 'user_email'
275 614 );
276 -
615 +
277 616 // User homepage.
278 617 $this->field_map[] = array(
279 - 'from_tablename' => 'user', 'from_fieldname' => 'homepage',
280 - 'to_type' => 'user', 'to_fieldname' => 'user_url'
618 + 'from_tablename' => 'users_table',
619 + 'from_fieldname' => 'the_users_homepage_url',
620 + 'to_type' => 'user',
621 + 'to_fieldname' => 'user_url'
281 622 );
282 -
623 +
283 624 // User registered.
284 625 $this->field_map[] = array(
285 - 'from_tablename' => 'user', 'from_fieldname' => 'joindate',
286 - 'to_type' => 'user', 'to_fieldname' => 'user_registered',
626 + 'from_tablename' => 'users_table',
627 + 'from_fieldname' => 'the_users_registration_date',
628 + 'to_type' => 'user',
629 + 'to_fieldname' => 'user_registered',
287 630 'callback_method' => 'callback_datetime'
288 631 );
289 -
290 - // User aim.
632 +
633 + // User status.
291 634 $this->field_map[] = array(
292 - 'from_tablename' => 'user', 'from_fieldname' => 'aim',
293 - 'to_type' => 'user', 'to_fieldname' => 'aim'
635 + 'from_tablename' => 'users_table',
636 + 'from_fieldname' => 'the_users_status',
637 + 'to_type' => 'user',
638 + 'to_fieldname' => 'user_status'
294 639 );
295 -
296 - // User yahoo.
640 +
641 + // User display name.
297 642 $this->field_map[] = array(
298 - 'from_tablename' => 'user', 'from_fieldname' => 'yahoo',
299 - 'to_type' => 'user', 'to_fieldname' => 'yim'
300 - );
643 + 'from_tablename' => 'users_table',
644 + 'from_fieldname' => 'the_users_display_name',
645 + 'to_type' => 'user',
646 + 'to_fieldname' => 'display_name'
647 + );
648 +
649 + // User Profile Field 1 (Stored in usermeta)
650 + $this->field_map[] = array(
651 + 'from_tablename' => 'users_table',
652 + 'from_fieldname' => 'the_users_custom_profile_field_1',
653 + 'to_type' => 'user',
654 + 'to_fieldname' => '_bbp_example_profile_field_1'
655 + );
656 +
657 + // User Profile Field 2 (Stored in usermeta)
658 + $this->field_map[] = array(
659 + 'from_tablename' => 'users_table',
660 + 'from_fieldname' => 'the_users_custom_profile_field_2',
661 + 'to_type' => 'user',
662 + 'to_fieldname' => '_bbp_example_profile_field_2'
663 + );
664 +
665 + // User Profile Field 3 (Stored in usermeta)
666 + $this->field_map[] = array(
667 + 'from_tablename' => 'users_table',
668 + 'from_fieldname' => 'the_users_custom_profile_field_3',
669 + 'to_type' => 'user',
670 + 'to_fieldname' => '_bbp_example_profile_field_3'
671 + );
672 +
673 + // Setup any table joins needed for the user section
674 + $this->field_map[] = array(
675 + 'from_tablename' => 'users_profile_table',
676 + 'from_fieldname' => 'the_users_id',
677 + 'join_tablename' => 'users_table',
678 + 'join_type' => 'INNER',
679 + 'join_expression' => 'USING users_profile_table.the_user_id = users_table.the_user_id',
680 + 'from_expression' => 'WHERE users_table.the_user_id != -1',
681 + 'to_type' => 'user'
682 + );
301 683 }
302 -
684 +
303 685 /**
304 686 * This method allows us to indicates what is or is not converted for each
305 687 * converter.
306 688 */
307 - public function info()
308 - {
689 + public function info() {
309 690 return '';
310 691 }
311 692
312 693 /**
@@ -311,12 +692,11 @@
311 692
312 693 /**
313 694 * This method is to save the salt and password together. That
314 695 * way when we authenticate it we can get it out of the database
315 - * as one value. Array values are auto sanitized by wordpress.
696 + * as one value. Array values are auto sanitized by WordPress.
316 697 */
317 - public function callback_savepass( $field, $row )
318 - {
698 + public function callback_savepass( $field, $row ) {
319 699 $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] );
320 700 return $pass_array;
321 701 }
322 702
@@ -323,10 +703,9 @@
323 703 /**
324 704 * This method is to take the pass out of the database and compare
325 705 * to a pass the user has typed in.
326 706 */
327 - public function authenticate_pass( $password, $serialized_pass )
328 - {
707 + public function authenticate_pass( $password, $serialized_pass ) {
329 708 $pass_array = unserialize( $serialized_pass );
330 709 return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
331 710 }
332 711 }