PluginProbe
bbPress / trunk
bbPress vtrunk
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 2.2.2 All 71 releases
bbpress / includes / admin / converters / bbPress1.php

bbPress1.php in bbPress trunk, at includes/admin/converters/bbPress1.php

752 lines 21.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress 1.x Converter
5 *
6 * @package bbPress
7 * @subpackage Converters
8 */
9
10 /**
11 * bbPress 1.1 Converter
12 *
13 * @since 2.1.0 bbPress (r3816)
14 *
15 * @link Codex Docs https://codex.bbpress.org/import-forums/bbpress-1-x-buddypress-group-forums
16 */
17 class bbPress1 extends BBP_Converter_Base {
18
19 /**
20 * Sets up the field mappings
21 */
22 public function setup_globals() {
23
24 // Setup smiley URL & path
25 $this->bbcode_parser_properties = array(
26 'smiley_url' => false,
27 'smiley_dir' => false
28 );
29
30 /** Forum Section *****************************************************/
31
32 // Old forum id (Stored in postmeta)
33 $this->field_map[] = array(
34 'from_tablename' => 'forums',
35 'from_fieldname' => 'forum_id',
36 'to_type' => 'forum',
37 'to_fieldname' => '_bbp_old_forum_id'
38 );
39
40 // Forum parent id (If no parent, then 0. Stored in postmeta)
41 $this->field_map[] = array(
42 'from_tablename' => 'forums',
43 'from_fieldname' => 'forum_parent',
44 'to_type' => 'forum',
45 'to_fieldname' => '_bbp_old_forum_parent_id'
46 );
47
48 // Forum topic count (Stored in postmeta)
49 $this->field_map[] = array(
50 'from_tablename' => 'forums',
51 'from_fieldname' => 'topics',
52 'to_type' => 'forum',
53 'to_fieldname' => '_bbp_topic_count'
54 );
55
56 // Forum reply count (Stored in postmeta)
57 $this->field_map[] = array(
58 'from_tablename' => 'forums',
59 'from_fieldname' => 'posts',
60 'to_type' => 'forum',
61 'to_fieldname' => '_bbp_reply_count'
62 );
63
64 // Forum total topic count (Stored in postmeta)
65 $this->field_map[] = array(
66 'from_tablename' => 'forums',
67 'from_fieldname' => 'topics',
68 'to_type' => 'forum',
69 'to_fieldname' => '_bbp_total_topic_count'
70 );
71
72 // Forum total reply count (Stored in postmeta)
73 $this->field_map[] = array(
74 'from_tablename' => 'forums',
75 'from_fieldname' => 'posts',
76 'to_type' => 'forum',
77 'to_fieldname' => '_bbp_total_reply_count'
78 );
79
80 // Forum title.
81 $this->field_map[] = array(
82 'from_tablename' => 'forums',
83 'from_fieldname' => 'forum_name',
84 'to_type' => 'forum',
85 'to_fieldname' => 'post_title'
86 );
87
88 // Forum slug (Clean name to avoid conflicts)
89 $this->field_map[] = array(
90 'from_tablename' => 'forums',
91 'from_fieldname' => 'forum_slug',
92 'to_type' => 'forum',
93 'to_fieldname' => 'post_name',
94 'callback_method' => 'callback_slug'
95 );
96
97 // Forum description.
98 $this->field_map[] = array(
99 'from_tablename' => 'forums',
100 'from_fieldname' => 'forum_desc',
101 'to_type' => 'forum',
102 'to_fieldname' => 'post_content',
103 'callback_method' => 'callback_null'
104 );
105
106 // Forum display order (Starts from 1)
107 $this->field_map[] = array(
108 'from_tablename' => 'forums',
109 'from_fieldname' => 'forum_order',
110 'to_type' => 'forum',
111 'to_fieldname' => 'menu_order'
112 );
113
114 // Forum type (bbPress v1.x Forum > 0 or Category = 0, Stored in postmeta)
115 $this->field_map[] = array(
116 'from_tablename' => 'meta',
117 'from_fieldname' => 'meta_value',
118 'join_tablename' => 'forums',
119 'join_type' => 'LEFT',
120 'join_expression' => 'ON meta.object_id = forums.forum_id AND meta.meta_key = "forum_is_category"',
121 'to_type' => 'forum',
122 'to_fieldname' => '_bbp_forum_type',
123 'callback_method' => 'callback_forum_type'
124 );
125
126 // Forum status (Set a default value 'open', Stored in postmeta)
127 $this->field_map[] = array(
128 'to_type' => 'forum',
129 'to_fieldname' => '_bbp_status',
130 'default' => 'open'
131 );
132
133 // Forum dates.
134 $this->field_map[] = array(
135 'to_type' => 'forum',
136 'to_fieldname' => 'post_date',
137 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
138 );
139 $this->field_map[] = array(
140 'to_type' => 'forum',
141 'to_fieldname' => 'post_date_gmt',
142 'default' => gmdate( 'Y-m-d H:i:s' )
143 );
144 $this->field_map[] = array(
145 'to_type' => 'forum',
146 'to_fieldname' => 'post_modified',
147 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
148 );
149 $this->field_map[] = array(
150 'to_type' => 'forum',
151 'to_fieldname' => 'post_modified_gmt',
152 'default' => gmdate( 'Y-m-d H:i:s' )
153 );
154
155 /** Forum Subscriptions Section ***************************************/
156
157 /**
158 * bbPress 1.x Forums do not support forum subscriptions
159 */
160
161 /** Topic Section *****************************************************/
162
163 // Old topic id (Stored in postmeta)
164 $this->field_map[] = array(
165 'from_tablename' => 'topics',
166 'from_fieldname' => 'topic_id',
167 'to_type' => 'topic',
168 'to_fieldname' => '_bbp_old_topic_id'
169 );
170
171 // Topic reply count (Stored in postmeta)
172 $this->field_map[] = array(
173 'from_tablename' => 'topics',
174 'from_fieldname' => 'topic_posts',
175 'to_type' => 'topic',
176 'to_fieldname' => '_bbp_reply_count',
177 'callback_method' => 'callback_topic_reply_count'
178 );
179
180 // Topic total reply count (Includes unpublished replies, Stored in postmeta)
181 $this->field_map[] = array(
182 'from_tablename' => 'topics',
183 'from_fieldname' => 'topic_posts',
184 'to_type' => 'topic',
185 'to_fieldname' => '_bbp_total_reply_count',
186 'callback_method' => 'callback_topic_reply_count'
187 );
188
189 // Topic parent forum id (If no parent, then 0. Stored in postmeta)
190 $this->field_map[] = array(
191 'from_tablename' => 'topics',
192 'from_fieldname' => 'forum_id',
193 'to_type' => 'topic',
194 'to_fieldname' => '_bbp_forum_id',
195 'callback_method' => 'callback_forumid'
196 );
197
198 // Topic author.
199 $this->field_map[] = array(
200 'from_tablename' => 'topics',
201 'from_fieldname' => 'topic_poster',
202 'to_type' => 'topic',
203 'to_fieldname' => 'post_author',
204 'callback_method' => 'callback_userid'
205 );
206
207 // Topic title.
208 $this->field_map[] = array(
209 'from_tablename' => 'topics',
210 'from_fieldname' => 'topic_title',
211 'to_type' => 'topic',
212 'to_fieldname' => 'post_title'
213 );
214
215 // Topic slug (Clean name to avoid conflicts)
216 $this->field_map[] = array(
217 'from_tablename' => 'topics',
218 'from_fieldname' => 'topic_slug',
219 'to_type' => 'topic',
220 'to_fieldname' => 'post_name',
221 'callback_method' => 'callback_slug'
222 );
223
224 // Topic content.
225 // Note: We join the 'posts' table because 'topics' table does not include content.
226 $this->field_map[] = array(
227 'from_tablename' => 'posts',
228 'from_fieldname' => 'post_text',
229 'join_tablename' => 'topics',
230 'join_type' => 'INNER',
231 'join_expression' => 'USING (topic_id) WHERE posts.post_position IN (0,1)',
232 'to_type' => 'topic',
233 'to_fieldname' => 'post_content',
234 'callback_method' => 'callback_html'
235 );
236
237 // Topic status (Spam, Trash or Publish, bbPress v1.x publish = 0, trash = 1 & spam = 2)
238 $this->field_map[] = array(
239 'from_tablename' => 'posts',
240 'from_fieldname' => 'post_status',
241 'join_tablename' => 'topics',
242 'join_type' => 'INNER',
243 'join_expression' => 'USING (topic_id) WHERE posts.post_position IN (0,1)',
244 'to_type' => 'topic',
245 'to_fieldname' => 'post_status',
246 'callback_method' => 'callback_status'
247 );
248
249 // Topic status (Publish or Closed to new replies)
250 $this->field_map[] = array(
251 'from_tablename' => 'topics',
252 'from_fieldname' => 'topic_open',
253 'to_type' => 'topic',
254 'to_fieldname' => '_bbp_old_closed_status_id',
255 'callback_method' => 'callback_topic_status'
256 );
257
258 // Topic author ip (Stored in postmeta)
259 // Note: We join the 'posts' table because 'topics' table does not include author ip.
260 $this->field_map[] = array(
261 'from_tablename' => 'posts',
262 'from_fieldname' => 'poster_ip',
263 'join_tablename' => 'topics',
264 'join_type' => 'INNER',
265 'join_expression' => 'USING (topic_id) WHERE posts.post_position IN (0,1)',
266 'to_type' => 'topic',
267 'to_fieldname' => '_bbp_author_ip'
268 );
269
270 // Topic parent forum id (If no parent, then 0)
271 $this->field_map[] = array(
272 'from_tablename' => 'topics',
273 'from_fieldname' => 'forum_id',
274 'to_type' => 'topic',
275 'to_fieldname' => 'post_parent',
276 'callback_method' => 'callback_forumid'
277 );
278
279 // Sticky status (Stored in postmeta)
280 $this->field_map[] = array(
281 'from_tablename' => 'topics',
282 'from_fieldname' => 'topic_sticky',
283 'to_type' => 'topic',
284 'to_fieldname' => '_bbp_old_sticky_status_id',
285 'callback_method' => 'callback_sticky_status'
286 );
287
288 // Topic dates.
289 $this->field_map[] = array(
290 'from_tablename' => 'topics',
291 'from_fieldname' => 'topic_start_time',
292 'to_type' => 'topic',
293 'to_fieldname' => 'post_date'
294 );
295 $this->field_map[] = array(
296 'from_tablename' => 'topics',
297 'from_fieldname' => 'topic_start_time',
298 'to_type' => 'topic',
299 'to_fieldname' => 'post_date_gmt'
300 );
301 $this->field_map[] = array(
302 'from_tablename' => 'topics',
303 'from_fieldname' => 'topic_time',
304 'to_type' => 'topic',
305 'to_fieldname' => 'post_modified'
306 );
307 $this->field_map[] = array(
308 'from_tablename' => 'topics',
309 'from_fieldname' => 'topic_time',
310 'to_type' => 'topic',
311 'to_fieldname' => 'post_modified_gmt'
312 );
313 $this->field_map[] = array(
314 'from_tablename' => 'topics',
315 'from_fieldname' => 'topic_time',
316 'to_type' => 'topic',
317 'to_fieldname' => '_bbp_last_active_time'
318 );
319
320 /** Tags Section ******************************************************/
321
322 // Topic id.
323 $this->field_map[] = array(
324 'from_tablename' => 'term_relationships',
325 'from_fieldname' => 'object_id',
326 'to_type' => 'tags',
327 'to_fieldname' => 'objectid',
328 'callback_method' => 'callback_topicid'
329 );
330
331 // Taxonomy ID.
332 $this->field_map[] = array(
333 'from_tablename' => 'term_taxonomy',
334 'from_fieldname' => 'term_taxonomy_id',
335 'join_tablename' => 'term_relationships',
336 'join_type' => 'INNER',
337 'join_expression' => 'USING (term_taxonomy_id)',
338 'to_type' => 'tags',
339 'to_fieldname' => 'taxonomy'
340 );
341
342 // Term description.
343 $this->field_map[] = array(
344 'from_tablename' => 'term_taxonomy',
345 'from_fieldname' => 'description',
346 'join_tablename' => 'term_relationships',
347 'join_type' => 'INNER',
348 'join_expression' => 'USING (term_taxonomy_id)',
349 'to_type' => 'tags',
350 'to_fieldname' => 'description',
351 'callback_method' => 'callback_html'
352 );
353
354 // Term text.
355 $this->field_map[] = array(
356 'from_tablename' => 'terms',
357 'from_fieldname' => 'name',
358 'join_tablename' => 'term_taxonomy',
359 'join_type' => 'INNER',
360 'join_expression' => 'USING (term_id) WHERE term_taxonomy.taxonomy = "bb_topic_tag"',
361 'to_type' => 'tags',
362 'to_fieldname' => 'name'
363 );
364
365 // Term slug.
366 $this->field_map[] = array(
367 'from_tablename' => 'terms',
368 'from_fieldname' => 'slug',
369 'join_tablename' => 'term_taxonomy',
370 'join_type' => 'INNER',
371 'join_expression' => 'USING (term_id) WHERE term_taxonomy.taxonomy = "bb_topic_tag"',
372 'to_type' => 'tags',
373 'to_fieldname' => 'slug',
374 'callback_method' => 'callback_slug'
375 );
376
377 /** Topic Subscriptions Section ***************************************/
378
379 // Subscribed user ID (Stored in usermeta)
380 $this->field_map[] = array(
381 'from_tablename' => 'term_relationships',
382 'from_fieldname' => 'user_id',
383 'to_type' => 'topic_subscriptions',
384 'to_fieldname' => 'user_id',
385 'callback_method' => 'callback_userid'
386 );
387
388 // Join the 'term_taxonomy' table to link 'terms' 'term_relationships' tables
389 $this->field_map[] = array(
390 'from_tablename' => 'term_taxonomy',
391 'from_fieldname' => 'term_taxonomy_id',
392 'join_tablename' => 'term_relationships',
393 'join_type' => 'INNER',
394 'join_expression' => 'USING (term_taxonomy_id)',
395 'to_type' => 'topic_subscriptions'
396 );
397
398 // Subscribed topic ID (Stored in usermeta)
399 $this->field_map[] = array(
400 'from_tablename' => 'terms',
401 'from_fieldname' => 'name',
402 'join_tablename' => 'term_taxonomy',
403 'join_type' => 'INNER',
404 'join_expression' => 'USING (term_id) WHERE term_taxonomy.taxonomy = "bb_subscribe"',
405 'to_type' => 'topic_subscriptions',
406 'to_fieldname' => '_bbp_subscriptions',
407 'callback_method' => 'callback_topic_subscriptions'
408 );
409
410 /** Favorites Section *************************************************/
411
412 // Favorited topic ID (Stored in usermeta)
413 $this->field_map[] = array(
414 'from_tablename' => 'usermeta',
415 'from_fieldname' => 'meta_value',
416 'from_expression' => 'WHERE usermeta.meta_key = "bb_favorites"',
417 'to_type' => 'favorites',
418 'to_fieldname' => '_bbp_favorites'
419 );
420
421 // Favorited user ID (Stored in usermeta)
422 $this->field_map[] = array(
423 'from_tablename' => 'usermeta',
424 'from_fieldname' => 'user_id',
425 'from_expression' => 'WHERE usermeta.meta_key = "bb_favorites"',
426 'to_type' => 'favorites',
427 'to_fieldname' => 'user_id',
428 'callback_method' => 'callback_userid'
429 );
430
431 /** Reply Section *****************************************************/
432
433 // Old reply id (Stored in postmeta)
434 $this->field_map[] = array(
435 'from_tablename' => 'posts',
436 'from_fieldname' => 'post_id',
437 'to_type' => 'reply',
438 'to_fieldname' => '_bbp_old_reply_id'
439 );
440
441 // Reply parent topic id (If no parent, then 0. Stored in postmeta)
442 // Note: We join the 'topics' table to limit the replies section to only import replies
443 $this->field_map[] = array(
444 'from_tablename' => 'topics',
445 'from_fieldname' => 'topic_id',
446 'join_tablename' => 'posts',
447 'join_type' => 'INNER',
448 'join_expression' => 'USING (topic_id) WHERE posts.post_position NOT IN (0,1)',
449 'to_type' => 'reply',
450 'to_fieldname' => '_bbp_topic_id',
451 'callback_method' => 'callback_topicid'
452 );
453
454 // Reply parent forum id (If no parent, then 0. Stored in postmeta)
455 $this->field_map[] = array(
456 'from_tablename' => 'posts',
457 'from_fieldname' => 'forum_id',
458 'to_type' => 'reply',
459 'to_fieldname' => '_bbp_forum_id',
460 'callback_method' => 'callback_forumid'
461 );
462
463 // Reply author ip (Stored in postmeta)
464 $this->field_map[] = array(
465 'from_tablename' => 'posts',
466 'from_fieldname' => 'poster_ip',
467 'to_type' => 'reply',
468 'to_fieldname' => '_bbp_author_ip'
469 );
470
471 // Reply author.
472 $this->field_map[] = array(
473 'from_tablename' => 'posts',
474 'from_fieldname' => 'poster_id',
475 'to_type' => 'reply',
476 'to_fieldname' => 'post_author',
477 'callback_method' => 'callback_userid'
478 );
479
480 // Reply status (Spam, Trash or Publish, bbPress v1.x publish = 0, trash = 1 & spam = 2)
481 $this->field_map[] = array(
482 'from_tablename' => 'posts',
483 'from_fieldname' => 'post_status',
484 'to_type' => 'reply',
485 'to_fieldname' => 'post_status',
486 'callback_method' => 'callback_status'
487 );
488
489 // Reply content.
490 $this->field_map[] = array(
491 'from_tablename' => 'posts',
492 'from_fieldname' => 'post_text',
493 'to_type' => 'reply',
494 'to_fieldname' => 'post_content',
495 'callback_method' => 'callback_html'
496 );
497
498 // Reply order.
499 $this->field_map[] = array(
500 'from_tablename' => 'posts',
501 'from_fieldname' => 'post_position',
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' => 'posts',
509 'from_fieldname' => 'topic_id',
510 'to_type' => 'reply',
511 'to_fieldname' => 'post_parent',
512 'callback_method' => 'callback_topicid'
513 );
514
515 // Reply dates.
516 $this->field_map[] = array(
517 'from_tablename' => 'posts',
518 'from_fieldname' => 'post_time',
519 'to_type' => 'reply',
520 'to_fieldname' => 'post_date'
521 );
522 $this->field_map[] = array(
523 'from_tablename' => 'posts',
524 'from_fieldname' => 'post_time',
525 'to_type' => 'reply',
526 'to_fieldname' => 'post_date_gmt'
527 );
528 $this->field_map[] = array(
529 'from_tablename' => 'posts',
530 'from_fieldname' => 'post_time',
531 'to_type' => 'reply',
532 'to_fieldname' => 'post_modified'
533 );
534 $this->field_map[] = array(
535 'from_tablename' => 'posts',
536 'from_fieldname' => 'post_time',
537 'to_type' => 'reply',
538 'to_fieldname' => 'post_modified_gmt'
539 );
540
541 /** User Section ******************************************************/
542
543 // Store old user id (Stored in usermeta)
544 $this->field_map[] = array(
545 'from_tablename' => 'users',
546 'from_fieldname' => 'ID',
547 'to_type' => 'user',
548 'to_fieldname' => '_bbp_old_user_id'
549 );
550
551 // Store old user password (Stored in usermeta)
552 $this->field_map[] = array(
553 'from_tablename' => 'users',
554 'from_fieldname' => 'user_pass',
555 'to_type' => 'user',
556 'to_fieldname' => '_bbp_password'
557 );
558
559 // User name.
560 $this->field_map[] = array(
561 'from_tablename' => 'users',
562 'from_fieldname' => 'user_login',
563 'to_type' => 'user',
564 'to_fieldname' => 'user_login'
565 );
566
567 // User nice name.
568 $this->field_map[] = array(
569 'from_tablename' => 'users',
570 'from_fieldname' => 'user_nicename',
571 'to_type' => 'user',
572 'to_fieldname' => 'user_nicename'
573 );
574
575 // User email.
576 $this->field_map[] = array(
577 'from_tablename' => 'users',
578 'from_fieldname' => 'user_email',
579 'to_type' => 'user',
580 'to_fieldname' => 'user_email'
581 );
582
583 // User homepage.
584 $this->field_map[] = array(
585 'from_tablename' => 'users',
586 'from_fieldname' => 'user_url',
587 'to_type' => 'user',
588 'to_fieldname' => 'user_url'
589 );
590
591 // User registered.
592 $this->field_map[] = array(
593 'from_tablename' => 'users',
594 'from_fieldname' => 'user_registered',
595 'to_type' => 'user',
596 'to_fieldname' => 'user_registered'
597 );
598
599 // User status.
600 $this->field_map[] = array(
601 'from_tablename' => 'users',
602 'from_fieldname' => 'user_status',
603 'to_type' => 'user',
604 'to_fieldname' => 'user_status'
605 );
606
607 // User display name.
608 $this->field_map[] = array(
609 'from_tablename' => 'users',
610 'from_fieldname' => 'display_name',
611 'to_type' => 'user',
612 'to_fieldname' => 'display_name'
613 );
614 }
615
616 /**
617 * This method allows us to indicates what is or is not converted for each
618 * converter.
619 */
620 public function info() {
621 return '';
622 }
623
624 /**
625 * Translate the post status from bbPress 1's numerics to WordPress's
626 * strings.
627 *
628 * @param int $status bbPress 1.x numeric post status
629 * @return string WordPress safe
630 */
631 public function callback_status( $status = 0 ) {
632 switch ( $status ) {
633 case 2 :
634 $status = 'spam'; // bbp_get_spam_status_id()
635 break;
636
637 case 1 :
638 $status = 'trash'; // bbp_get_trash_status_id()
639 break;
640
641 case 0 :
642 default :
643 $status = 'publish'; // bbp_get_public_status_id()
644 break;
645 }
646 return $status;
647 }
648
649 /**
650 * Translate the forum type from bbPress 1.x numerics to WordPress's strings.
651 *
652 * @param int $status bbPress 1.x numeric forum type
653 * @return string WordPress safe
654 */
655 public function callback_forum_type( $status = 0 ) {
656 if ( 1 === (int) $status ) {
657 $status = 'category';
658 } else {
659 $status = 'forum';
660 }
661 return $status;
662 }
663
664 /**
665 * Translate the topic status from bbPress 1's numerics to WordPress's
666 * strings.
667 *
668 * @param int $topic_status bbPress 1.x numeric status
669 * @return string WordPress safe
670 */
671 public function callback_topic_status( $topic_status = 1 ) {
672 switch ( $topic_status ) {
673 case 0 :
674 $topic_status = 'closed'; // bbp_get_closed_status_id()
675 break;
676
677 case 1 :
678 default :
679 $topic_status = 'publish'; // bbp_get_public_status_id()
680 break;
681 }
682 return $topic_status;
683 }
684
685 /**
686 * Translate the topic sticky status type from bbPress 1.x numerics to WordPress's strings.
687 *
688 * @param int $status bbPress 1.x numeric forum type
689 * @return string WordPress safe
690 */
691 public function callback_sticky_status( $status = 0 ) {
692 switch ( $status ) {
693 case 2 :
694 $status = 'super-sticky'; // bbPress Super Sticky 'topic_sticky = 2'
695 break;
696
697 case 1 :
698 $status = 'sticky'; // bbPress Sticky 'topic_sticky = 1'
699 break;
700
701 case 0 :
702 default :
703 $status = 'normal'; // bbPress Normal Topic 'topic_sticky = 0'
704 break;
705 }
706 return $status;
707 }
708
709 /**
710 * Verify the topic reply count.
711 *
712 * @param int $count bbPress 1.x topic and reply counts
713 * @return string WordPress safe
714 */
715 public function callback_topic_reply_count( $count = 1 ) {
716 $count = absint( (int) $count - 1 );
717 return $count;
718 }
719
720 /**
721 * This method is to save the salt and password together. That
722 * way when we authenticate it we can get it out of the database
723 * as one value. Array values are auto sanitized by WordPress.
724 */
725 public function callback_savepass( $field, $row ) {
726 return false;
727 }
728
729 /**
730 * This method is to take the pass out of the database and compare
731 * to a pass the user has typed in.
732 */
733 public function authenticate_pass( $password, $serialized_pass ) {
734 return false;
735 }
736
737 /**
738 * This callback strips `topic-` from topic subscriptions taxonomy
739 *
740 * @since 2.6.0 bbPress (r5572)
741 *
742 * @param string $field Topic ID
743 * @return integer WordPress safe
744 */
745 protected function callback_topic_subscriptions( $field ) {
746
747 // Replace 'topic-' with '' so that only the original topic ID remains
748 $field = absint( (int) preg_replace( '/(topic-)(\d+)/', '$2', $field ) );
749 return $field;
750 }
751 }
752