Kunena3

Implementation of Kunena v3.x Forums for Joomla Forum converter.

Defined (1)

The class is defined in the following location(s).

/includes/admin/converters/Kunena3.php  
  1. class Kunena3 extends BBP_Converter_Base { 
  2.  
  3. /** 
  4. * Main Constructor 
  5. * @uses Kunena3::setup_globals() 
  6. */ 
  7. function __construct() { 
  8. parent::__construct(); 
  9. $this->setup_globals(); 
  10.  
  11. /** 
  12. * Sets up the field mappings 
  13. */ 
  14. public function setup_globals() { 
  15.  
  16. /** Forum Section *****************************************************/ 
  17.  
  18. // Forum id (Stored in postmeta) 
  19. $this->field_map[] = array( 
  20. 'from_tablename' => 'kunena_categories',  
  21. 'from_fieldname' => 'id',  
  22. 'to_type' => 'forum',  
  23. 'to_fieldname' => '_bbp_forum_id' 
  24. ); 
  25.  
  26. // Forum parent id (If no parent, then 0, Stored in postmeta) 
  27. $this->field_map[] = array( 
  28. 'from_tablename' => 'kunena_categories',  
  29. 'from_fieldname' => 'parent_id',  
  30. 'to_type' => 'forum',  
  31. 'to_fieldname' => '_bbp_forum_parent_id' 
  32. ); 
  33.  
  34. // Forum topic count (Stored in postmeta) 
  35. $this->field_map[] = array( 
  36. 'from_tablename' => 'kunena_categories',  
  37. 'from_fieldname' => 'numTopics',  
  38. 'to_type' => 'forum',  
  39. 'to_fieldname' => '_bbp_topic_count' 
  40. ); 
  41.  
  42. // Forum reply count (Stored in postmeta) 
  43. $this->field_map[] = array( 
  44. 'from_tablename' => 'kunena_categories',  
  45. 'from_fieldname' => 'numPosts',  
  46. 'to_type' => 'forum',  
  47. 'to_fieldname' => '_bbp_reply_count' 
  48. ); 
  49.  
  50. // Forum total topic count (Includes unpublished topics, Stored in postmeta) 
  51. $this->field_map[] = array( 
  52. 'from_tablename' => 'kunena_categories',  
  53. 'from_fieldname' => 'numTopics',  
  54. 'to_type' => 'forum',  
  55. 'to_fieldname' => '_bbp_total_topic_count' 
  56. ); 
  57.  
  58. // Forum total reply count (Includes unpublished replies, Stored in postmeta) 
  59. $this->field_map[] = array( 
  60. 'from_tablename' => 'kunena_categories',  
  61. 'from_fieldname' => 'numPosts',  
  62. 'to_type' => 'forum',  
  63. 'to_fieldname' => '_bbp_total_reply_count' 
  64. ); 
  65.  
  66. // Forum title. 
  67. $this->field_map[] = array( 
  68. 'from_tablename' => 'kunena_categories',  
  69. 'from_fieldname' => 'name',  
  70. 'to_type' => 'forum',  
  71. 'to_fieldname' => 'post_title' 
  72. ); 
  73.  
  74. // Forum slug (Clean name to avoid conflicts) 
  75. $this->field_map[] = array( 
  76. 'from_tablename' => 'kunena_categories',  
  77. 'from_fieldname' => 'alias',  
  78. 'to_type' => 'forum',  
  79. 'to_fieldname' => 'post_name',  
  80. 'callback_method' => 'callback_slug' 
  81. ); 
  82.  
  83. // Forum description. 
  84. $this->field_map[] = array( 
  85. 'from_tablename' => 'kunena_categories',  
  86. 'from_fieldname' => 'description',  
  87. 'to_type' => 'forum',  
  88. 'to_fieldname' => 'post_content',  
  89. 'callback_method' => 'callback_null' 
  90. ); 
  91.  
  92. // Forum display order (Starts from 1) 
  93. $this->field_map[] = array( 
  94. 'from_tablename' => 'kunena_categories',  
  95. 'from_fieldname' => 'ordering',  
  96. 'to_type' => 'forum',  
  97. 'to_fieldname' => 'menu_order' 
  98. ); 
  99.  
  100. // Forum type (Category = 0 or Forum = >0, Stored in postmeta) 
  101. $this->field_map[] = array( 
  102. 'from_tablename' => 'kunena_categories',  
  103. 'from_fieldname' => 'parent_id',  
  104. 'to_type' => 'forum',  
  105. 'to_fieldname' => '_bbp_forum_type',  
  106. 'callback_method' => 'callback_forum_type' 
  107. ); 
  108.  
  109. // Forum status (Open = 0 or Closed = 1, Stored in postmeta) 
  110. $this->field_map[] = array( 
  111. 'from_tablename' => 'kunena_categories',  
  112. 'from_fieldname' => 'locked',  
  113. 'to_type' => 'forum',  
  114. 'to_fieldname' => '_bbp_status',  
  115. 'callback_method' => 'callback_forum_status' 
  116. ); 
  117.  
  118. // Forum dates. 
  119. $this->field_map[] = array( 
  120. 'to_type' => 'forum',  
  121. 'to_fieldname' => 'post_date',  
  122. 'default' => date('Y-m-d H:i:s') 
  123. ); 
  124. $this->field_map[] = array( 
  125. 'to_type' => 'forum',  
  126. 'to_fieldname' => 'post_date_gmt',  
  127. 'default' => date('Y-m-d H:i:s') 
  128. ); 
  129. $this->field_map[] = array( 
  130. 'to_type' => 'forum',  
  131. 'to_fieldname' => 'post_modified',  
  132. 'default' => date('Y-m-d H:i:s') 
  133. ); 
  134. $this->field_map[] = array( 
  135. 'to_type' => 'forum',  
  136. 'to_fieldname' => 'post_modified_gmt',  
  137. 'default' => date('Y-m-d H:i:s') 
  138. ); 
  139.  
  140. /** Topic Section *****************************************************/ 
  141.  
  142. // Topic id (Stored in postmeta) 
  143. $this->field_map[] = array( 
  144. 'from_tablename' => 'kunena_topics',  
  145. 'from_fieldname' => 'id',  
  146. 'to_type' => 'topic',  
  147. 'to_fieldname' => '_bbp_topic_id' 
  148. ); 
  149.  
  150. // Topic reply count (Stored in postmeta) 
  151. $this->field_map[] = array( 
  152. 'from_tablename' => 'kunena_topics',  
  153. 'from_fieldname' => 'posts',  
  154. 'to_type' => 'topic',  
  155. 'to_fieldname' => '_bbp_reply_count',  
  156. 'callback_method' => 'callback_topic_reply_count' 
  157. ); 
  158.  
  159. // Topic total reply count (Includes unpublished replies, Stored in postmeta) 
  160. $this->field_map[] = array( 
  161. 'from_tablename' => 'kunena_topics',  
  162. 'from_fieldname' => 'posts',  
  163. 'to_type' => 'topic',  
  164. 'to_fieldname' => '_bbp_total_reply_count',  
  165. 'callback_method' => 'callback_topic_reply_count' 
  166. ); 
  167.  
  168. // Topic parent forum id (If no parent, then 0. Stored in postmeta) 
  169. $this->field_map[] = array( 
  170. 'from_tablename' => 'kunena_topics',  
  171. 'from_fieldname' => 'category_id',  
  172. 'to_type' => 'topic',  
  173. 'to_fieldname' => '_bbp_forum_id',  
  174. 'callback_method' => 'callback_forumid' 
  175. ); 
  176.  
  177. // Topic author. 
  178. $this->field_map[] = array( 
  179. 'from_tablename' => 'kunena_topics',  
  180. 'from_fieldname' => 'first_post_userid',  
  181. 'to_type' => 'topic',  
  182. 'to_fieldname' => 'post_author',  
  183. 'callback_method' => 'callback_userid' 
  184. ); 
  185.  
  186. // Topic Author ip (Stored in postmeta) 
  187. // Note: We join the 'kunena_messages' table because 'kunena_topics' table does not include author ip. 
  188. $this->field_map[] = array( 
  189. 'from_tablename' => 'kunena_messages',  
  190. 'from_fieldname' => 'ip',  
  191. 'join_tablename' => 'kunena_topics',  
  192. 'join_type' => 'LEFT',  
  193. 'join_expression' => 'USING (id)',  
  194. 'to_type' => 'topic',  
  195. 'to_fieldname' => '_bbp_author_ip' 
  196. ); 
  197.  
  198. // Topic content. 
  199. $this->field_map[] = array( 
  200. 'from_tablename' => 'kunena_topics',  
  201. 'from_fieldname' => 'first_post_message',  
  202. 'to_type' => 'topic',  
  203. 'to_fieldname' => 'post_content',  
  204. 'callback_method' => 'callback_html' 
  205. ); 
  206.  
  207. // Topic title. 
  208. $this->field_map[] = array( 
  209. 'from_tablename' => 'kunena_topics',  
  210. 'from_fieldname' => 'subject',  
  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' => 'kunena_topics',  
  218. 'from_fieldname' => 'subject',  
  219. 'to_type' => 'topic',  
  220. 'to_fieldname' => 'post_name',  
  221. 'callback_method' => 'callback_slug' 
  222. ); 
  223.  
  224. // Topic parent forum id (If no parent, then 0) 
  225. $this->field_map[] = array( 
  226. 'from_tablename' => 'kunena_topics',  
  227. 'from_fieldname' => 'category_id',  
  228. 'to_type' => 'topic',  
  229. 'to_fieldname' => 'post_parent',  
  230. 'callback_method' => 'callback_forumid' 
  231. ); 
  232.  
  233. // Topic dates. 
  234. $this->field_map[] = array( 
  235. 'from_tablename' => 'kunena_topics',  
  236. 'from_fieldname' => 'first_post_time',  
  237. 'to_type' => 'topic',  
  238. 'to_fieldname' => 'post_date',  
  239. 'callback_method' => 'callback_datetime' 
  240. ); 
  241. $this->field_map[] = array( 
  242. 'from_tablename' => 'kunena_topics',  
  243. 'from_fieldname' => 'first_post_time',  
  244. 'to_type' => 'topic',  
  245. 'to_fieldname' => 'post_date_gmt',  
  246. 'callback_method' => 'callback_datetime' 
  247. ); 
  248. $this->field_map[] = array( 
  249. 'from_tablename' => 'kunena_topics',  
  250. 'from_fieldname' => 'last_post_time',  
  251. 'to_type' => 'topic',  
  252. 'to_fieldname' => 'post_modified',  
  253. 'callback_method' => 'callback_datetime' 
  254. ); 
  255. $this->field_map[] = array( 
  256. 'from_tablename' => 'kunena_topics',  
  257. 'from_fieldname' => 'last_post_time',  
  258. 'to_type' => 'topic',  
  259. 'to_fieldname' => 'post_modified_gmt',  
  260. 'callback_method' => 'callback_datetime' 
  261. ); 
  262. $this->field_map[] = array( 
  263. 'from_tablename' => 'kunena_topics',  
  264. 'from_fieldname' => 'last_post_time',  
  265. 'to_type' => 'topic',  
  266. 'to_fieldname' => '_bbp_last_active_time',  
  267. 'callback_method' => 'callback_datetime' 
  268. ); 
  269.  
  270. // Topic status (Open or Closed, Kunena v3.x 0=open & 1=closed) 
  271. $this->field_map[] = array( 
  272. 'from_tablename' => 'kunena_topics',  
  273. 'from_fieldname' => 'locked',  
  274. 'to_type' => 'topic',  
  275. 'to_fieldname' => 'post_status',  
  276. 'callback_method' => 'callback_topic_status' 
  277. ); 
  278.  
  279. /** Tags Section ******************************************************/ 
  280.  
  281. /** 
  282. * Kunena v3.x Forums do not support topic tags out of the box 
  283. */ 
  284.  
  285. /** Reply Section ******************************************************/ 
  286.  
  287. // Reply id (Stored in postmeta) 
  288. $this->field_map[] = array( 
  289. 'from_tablename' => 'kunena_messages',  
  290. 'from_fieldname' => 'id',  
  291. 'to_type' => 'reply',  
  292. 'to_fieldname' => '_bbp_post_id' 
  293. ); 
  294.  
  295. // Reply parent forum id (If no parent, then 0. Stored in postmeta) 
  296. $this->field_map[] = array( 
  297. 'from_tablename' => 'kunena_messages',  
  298. 'from_fieldname' => 'catid',  
  299. 'to_type' => 'reply',  
  300. 'to_fieldname' => '_bbp_forum_id',  
  301. 'callback_method' => 'callback_topicid_to_forumid' 
  302. ); 
  303.  
  304. // Reply parent topic id (If no parent, then 0. Stored in postmeta) 
  305. $this->field_map[] = array( 
  306. 'from_tablename' => 'kunena_messages',  
  307. 'from_fieldname' => 'thread',  
  308. 'to_type' => 'reply',  
  309. 'to_fieldname' => '_bbp_topic_id',  
  310. 'callback_method' => 'callback_topicid' 
  311. ); 
  312.  
  313. // Reply author ip (Stored in postmeta) 
  314. $this->field_map[] = array( 
  315. 'from_tablename' => 'kunena_messages',  
  316. 'from_fieldname' => 'ip',  
  317. 'to_type' => 'reply',  
  318. 'to_fieldname' => '_bbp_author_ip' 
  319. ); 
  320.  
  321. // Reply author. 
  322. $this->field_map[] = array( 
  323. 'from_tablename' => 'kunena_messages',  
  324. 'from_fieldname' => 'userid',  
  325. 'to_type' => 'reply',  
  326. 'to_fieldname' => 'post_author',  
  327. 'callback_method' => 'callback_userid' 
  328. ); 
  329.  
  330. // Reply title. 
  331. $this->field_map[] = array( 
  332. 'from_tablename' => 'kunena_messages',  
  333. 'from_fieldname' => 'subject',  
  334. 'to_type' => 'reply',  
  335. 'to_fieldname' => 'post_title',  
  336. 'callback_method' => 'callback_reply_title' 
  337. ); 
  338.  
  339. // Reply slug (Clean name to avoid conflicts) 
  340. $this->field_map[] = array( 
  341. 'from_tablename' => 'kunena_messages',  
  342. 'from_fieldname' => 'subject',  
  343. 'to_type' => 'reply',  
  344. 'to_fieldname' => 'post_name',  
  345. 'callback_method' => 'callback_slug' 
  346. ); 
  347.  
  348. // Reply content. 
  349. // Note: We join the 'kunena_messages_text' table because 'kunena_messages' table does not include reply content. 
  350. $this->field_map[] = array( 
  351. 'from_tablename' => 'kunena_messages_text',  
  352. 'from_fieldname' => 'message',  
  353. 'join_tablename' => 'kunena_messages',  
  354. 'join_type' => 'LEFT',  
  355. 'join_expression' => 'ON kunena_messages_text.mesid = kunena_messages.id LEFT JOIN jos_kunena_topics AS kunena_topics ON kunena_messages.thread = kunena_topics.id WHERE kunena_messages.parent != 0',  
  356. 'to_type' => 'reply',  
  357. 'to_fieldname' => 'post_content',  
  358. 'callback_method' => 'callback_html' 
  359. ); 
  360.  
  361. // Reply parent topic id (If no parent, then 0) 
  362. $this->field_map[] = array( 
  363. 'from_tablename' => 'kunena_messages',  
  364. 'from_fieldname' => 'thread',  
  365. 'to_type' => 'reply',  
  366. 'to_fieldname' => 'post_parent',  
  367. 'callback_method' => 'callback_topicid' 
  368. ); 
  369.  
  370. // Reply dates. 
  371. $this->field_map[] = array( 
  372. 'from_tablename' => 'kunena_messages',  
  373. 'from_fieldname' => 'time',  
  374. 'to_type' => 'reply',  
  375. 'to_fieldname' => 'post_date',  
  376. 'callback_method' => 'callback_datetime' 
  377. ); 
  378. $this->field_map[] = array( 
  379. 'from_tablename' => 'kunena_messages',  
  380. 'from_fieldname' => 'time',  
  381. 'to_type' => 'reply',  
  382. 'to_fieldname' => 'post_date_gmt',  
  383. 'callback_method' => 'callback_datetime' 
  384. ); 
  385. $this->field_map[] = array( 
  386. 'from_tablename' => 'kunena_messages',  
  387. 'from_fieldname' => 'time',  
  388. 'to_type' => 'reply',  
  389. 'to_fieldname' => 'post_modified',  
  390. 'callback_method' => 'callback_datetime' 
  391. ); 
  392. $this->field_map[] = array( 
  393. 'from_tablename' => 'kunena_messages',  
  394. 'from_fieldname' => 'time',  
  395. 'to_type' => 'reply',  
  396. 'to_fieldname' => 'post_modified_gmt',  
  397. 'callback_method' => 'callback_datetime' 
  398. ); 
  399.  
  400. /** User Section ******************************************************/ 
  401.  
  402. //Note: We are importing the Joomla User details and the Kunena v3.x user profile details. 
  403.  
  404. // Store old User id (Stored in usermeta) 
  405. $this->field_map[] = array( 
  406. 'from_tablename' => 'users',  
  407. 'from_fieldname' => 'id',  
  408. 'to_type' => 'user',  
  409. 'to_fieldname' => '_bbp_user_id' 
  410. ); 
  411.  
  412. // Store old User password (Stored in usermeta serialized with salt) 
  413. $this->field_map[] = array( 
  414. 'from_tablename' => 'users',  
  415. 'from_fieldname' => 'password',  
  416. 'to_type' => 'user',  
  417. 'to_fieldname' => '_bbp_password',  
  418. 'callback_method' => 'callback_savepass' 
  419. ); 
  420.  
  421. // Store old User Salt (This is only used for the SELECT row info for the above password save) 
  422. // $this->field_map[] = array( 
  423. // 'from_tablename' => 'users',  
  424. // 'from_fieldname' => 'salt',  
  425. // 'to_type' => 'user',  
  426. // 'to_fieldname' => '' 
  427. // ); 
  428.  
  429. // User password verify class (Stored in usermeta for verifying password) 
  430. $this->field_map[] = array( 
  431. 'to_type' => 'users',  
  432. 'to_fieldname' => '_bbp_class',  
  433. 'default' => 'Kunena3' 
  434. ); 
  435.  
  436. // User name. 
  437. $this->field_map[] = array( 
  438. 'from_tablename' => 'users',  
  439. 'from_fieldname' => 'username',  
  440. 'to_type' => 'user',  
  441. 'to_fieldname' => 'user_login' 
  442. ); 
  443.  
  444. // User nice name. 
  445. $this->field_map[] = array( 
  446. 'from_tablename' => 'users',  
  447. 'from_fieldname' => 'username',  
  448. 'to_type' => 'user',  
  449. 'to_fieldname' => 'user_nicename' 
  450. ); 
  451.  
  452. // User email. 
  453. $this->field_map[] = array( 
  454. 'from_tablename' => 'users',  
  455. 'from_fieldname' => 'email',  
  456. 'to_type' => 'user',  
  457. 'to_fieldname' => 'user_email' 
  458. ); 
  459.  
  460. // User homepage. 
  461. $this->field_map[] = array( 
  462. 'from_tablename' => 'kunena_users',  
  463. 'from_fieldname' => 'websiteurl',  
  464. 'join_tablename' => 'users',  
  465. 'join_type' => 'LEFT',  
  466. 'join_expression' => 'ON kunena_users.userid = users.id',  
  467. 'to_type' => 'user',  
  468. 'to_fieldname' => 'user_url' 
  469. ); 
  470.  
  471. // User registered. 
  472. $this->field_map[] = array( 
  473. 'from_tablename' => 'users',  
  474. 'from_fieldname' => 'registerDate',  
  475. 'to_type' => 'user',  
  476. 'to_fieldname' => 'user_registered',  
  477. 'callback_method' => 'callback_datetime' 
  478. ); 
  479.  
  480. // User display name. 
  481. $this->field_map[] = array( 
  482. 'from_tablename' => 'users',  
  483. 'from_fieldname' => 'name',  
  484. 'to_type' => 'user',  
  485. 'to_fieldname' => 'display_name' 
  486. ); 
  487.  
  488. // User AIM (Stored in usermeta) 
  489. $this->field_map[] = array( 
  490. 'from_tablename' => 'kunena_users',  
  491. 'from_fieldname' => 'aim',  
  492. 'join_tablename' => 'users',  
  493. 'join_type' => 'LEFT',  
  494. 'join_expression' => 'ON kunena_users.userid = users.id',  
  495. 'to_type' => 'user',  
  496. 'to_fieldname' => 'aim' 
  497. ); 
  498.  
  499. // User Yahoo (Stored in usermeta) 
  500. $this->field_map[] = array( 
  501. 'from_tablename' => 'kunena_users',  
  502. 'from_fieldname' => 'yim',  
  503. 'join_tablename' => 'users',  
  504. 'join_type' => 'LEFT',  
  505. 'join_expression' => 'ON kunena_users.userid = users.id',  
  506. 'to_type' => 'user',  
  507. 'to_fieldname' => 'yim' 
  508. ); 
  509.  
  510. // Store Google Tak (Stored in usermeta) 
  511. $this->field_map[] = array( 
  512. 'from_tablename' => 'kunena_users',  
  513. 'from_fieldname' => 'gtalk',  
  514. 'join_tablename' => 'users',  
  515. 'join_type' => 'LEFT',  
  516. 'join_expression' => 'ON kunena_users.userid = users.id',  
  517. 'to_type' => 'user',  
  518. 'to_fieldname' => 'jabber' 
  519. ); 
  520.  
  521. // Store ICQ (Stored in usermeta) 
  522. $this->field_map[] = array( 
  523. 'from_tablename' => 'kunena_users',  
  524. 'from_fieldname' => 'icq',  
  525. 'join_tablename' => 'users',  
  526. 'join_type' => 'LEFT',  
  527. 'join_expression' => 'ON kunena_users.userid = users.id',  
  528. 'to_type' => 'user',  
  529. 'to_fieldname' => '_bbp_kunena3_user_icq' 
  530. ); 
  531.  
  532. // Store MSN (Stored in usermeta) 
  533. $this->field_map[] = array( 
  534. 'from_tablename' => 'kunena_users',  
  535. 'from_fieldname' => 'msn',  
  536. 'join_tablename' => 'users',  
  537. 'join_type' => 'LEFT',  
  538. 'join_expression' => 'ON kunena_users.userid = users.id',  
  539. 'to_type' => 'user',  
  540. 'to_fieldname' => '_bbp_kunena3_user_msn' 
  541. ); 
  542.  
  543. // Store Skype (Stored in usermeta) 
  544. $this->field_map[] = array( 
  545. 'from_tablename' => 'kunena_users',  
  546. 'from_fieldname' => 'skype',  
  547. 'join_tablename' => 'users',  
  548. 'join_type' => 'LEFT',  
  549. 'join_expression' => 'ON kunena_users.userid = users.id',  
  550. 'to_type' => 'user',  
  551. 'to_fieldname' => '_bbp_kunena3_user_skype' 
  552. ); 
  553.  
  554. // Store Twitter (Stored in usermeta) 
  555. $this->field_map[] = array( 
  556. 'from_tablename' => 'kunena_users',  
  557. 'from_fieldname' => 'twitter',  
  558. 'join_tablename' => 'users',  
  559. 'join_type' => 'LEFT',  
  560. 'join_expression' => 'ON kunena_users.userid = users.id',  
  561. 'to_type' => 'user',  
  562. 'to_fieldname' => '_bbp_kunena3_user_twitter' 
  563. ); 
  564.  
  565. // Store Facebook (Stored in usermeta) 
  566. $this->field_map[] = array( 
  567. 'from_tablename' => 'kunena_users',  
  568. 'from_fieldname' => 'facebook',  
  569. 'join_tablename' => 'users',  
  570. 'join_type' => 'LEFT',  
  571. 'join_expression' => 'ON kunena_users.userid = users.id',  
  572. 'to_type' => 'user',  
  573. 'to_fieldname' => '_bbp_kunena3_user_facebook' 
  574. ); 
  575.  
  576. // Store myspace (Stored in usermeta) 
  577. $this->field_map[] = array( 
  578. 'from_tablename' => 'kunena_users',  
  579. 'from_fieldname' => 'myspace',  
  580. 'join_tablename' => 'users',  
  581. 'join_type' => 'LEFT',  
  582. 'join_expression' => 'ON kunena_users.userid = users.id',  
  583. 'to_type' => 'user',  
  584. 'to_fieldname' => '_bbp_kunena3_user_myspace' 
  585. ); 
  586.  
  587. // Store linkedin (Stored in usermeta) 
  588. $this->field_map[] = array( 
  589. 'from_tablename' => 'kunena_users',  
  590. 'from_fieldname' => 'linkedin',  
  591. 'join_tablename' => 'users',  
  592. 'join_type' => 'LEFT',  
  593. 'join_expression' => 'ON kunena_users.userid = users.id',  
  594. 'to_type' => 'user',  
  595. 'to_fieldname' => '_bbp_kunena3_user_linkedin' 
  596. ); 
  597.  
  598. // Store delicious (Stored in usermeta) 
  599. $this->field_map[] = array( 
  600. 'from_tablename' => 'kunena_users',  
  601. 'from_fieldname' => 'delicious',  
  602. 'join_tablename' => 'users',  
  603. 'join_type' => 'LEFT',  
  604. 'join_expression' => 'ON kunena_users.userid = users.id',  
  605. 'to_type' => 'user',  
  606. 'to_fieldname' => '_bbp_kunena3_user_delicious' 
  607. ); 
  608.  
  609. // Store friendfeed (Stored in usermeta) 
  610. $this->field_map[] = array( 
  611. 'from_tablename' => 'kunena_users',  
  612. 'from_fieldname' => 'friendfeed',  
  613. 'join_tablename' => 'users',  
  614. 'join_type' => 'LEFT',  
  615. 'join_expression' => 'ON kunena_users.userid = users.id',  
  616. 'to_type' => 'user',  
  617. 'to_fieldname' => '_bbp_kunena3_user_friendfeed' 
  618. ); 
  619.  
  620. // Store digg (Stored in usermeta) 
  621. $this->field_map[] = array( 
  622. 'from_tablename' => 'kunena_users',  
  623. 'from_fieldname' => 'digg',  
  624. 'join_tablename' => 'users',  
  625. 'join_type' => 'LEFT',  
  626. 'join_expression' => 'ON kunena_users.userid = users.id',  
  627. 'to_type' => 'user',  
  628. 'to_fieldname' => '_bbp_kunena3_user_digg' 
  629. ); 
  630.  
  631. // Store blogspot (Stored in usermeta) 
  632. $this->field_map[] = array( 
  633. 'from_tablename' => 'kunena_users',  
  634. 'from_fieldname' => 'blogspot',  
  635. 'join_tablename' => 'users',  
  636. 'join_type' => 'LEFT',  
  637. 'join_expression' => 'ON kunena_users.userid = users.id',  
  638. 'to_type' => 'user',  
  639. 'to_fieldname' => '_bbp_kunena3_user_blogspot' 
  640. ); 
  641.  
  642. // Store flickr (Stored in usermeta) 
  643. $this->field_map[] = array( 
  644. 'from_tablename' => 'kunena_users',  
  645. 'from_fieldname' => 'flickr',  
  646. 'join_tablename' => 'users',  
  647. 'join_type' => 'LEFT',  
  648. 'join_expression' => 'ON kunena_users.userid = users.id',  
  649. 'to_type' => 'user',  
  650. 'to_fieldname' => '_bbp_kunena3_user_flickr' 
  651. ); 
  652.  
  653. // Store bebo (Stored in usermeta) 
  654. $this->field_map[] = array( 
  655. 'from_tablename' => 'kunena_users',  
  656. 'from_fieldname' => 'bebo',  
  657. 'join_tablename' => 'users',  
  658. 'join_type' => 'LEFT',  
  659. 'join_expression' => 'ON kunena_users.userid = users.id',  
  660. 'to_type' => 'user',  
  661. 'to_fieldname' => '_bbp_kunena3_user_bebo' 
  662. ); 
  663.  
  664. // Store websitename (Stored in usermeta) 
  665. $this->field_map[] = array( 
  666. 'from_tablename' => 'kunena_users',  
  667. 'from_fieldname' => 'websitename',  
  668. 'join_tablename' => 'users',  
  669. 'join_type' => 'LEFT',  
  670. 'join_expression' => 'ON kunena_users.userid = users.id',  
  671. 'to_type' => 'user',  
  672. 'to_fieldname' => '_bbp_kunena3_user_websitename' 
  673. ); 
  674.  
  675. // Store location (Stored in usermeta) 
  676. $this->field_map[] = array( 
  677. 'from_tablename' => 'kunena_users',  
  678. 'from_fieldname' => 'location',  
  679. 'join_tablename' => 'users',  
  680. 'join_type' => 'LEFT',  
  681. 'join_expression' => 'ON kunena_users.userid = users.id',  
  682. 'to_type' => 'user',  
  683. 'to_fieldname' => '_bbp_kunena3_user_location' 
  684. ); 
  685.  
  686. // Store Signature (Stored in usermeta) 
  687. $this->field_map[] = array( 
  688. 'from_tablename' => 'kunena_users',  
  689. 'from_fieldname' => 'signature',  
  690. 'join_tablename' => 'users',  
  691. 'join_type' => 'LEFT',  
  692. 'join_expression' => 'ON kunena_users.userid = users.id',  
  693. 'to_type' => 'user',  
  694. 'to_fieldname' => '_bbp_kunena3_user_sig',  
  695. 'callback_method' => 'callback_html' 
  696. ); 
  697.  
  698. /** 
  699. * This method allows us to indicates what is or is not converted for each 
  700. * converter. 
  701. */ 
  702. public function info() 
  703. return ''; 
  704.  
  705. /** 
  706. * This method is to save the salt and password together. That 
  707. * way when we authenticate it we can get it out of the database 
  708. * as one value. Array values are auto sanitized by WordPress. 
  709. */ 
  710. public function callback_savepass( $field, $row ) 
  711. $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] ); 
  712. return $pass_array; 
  713.  
  714. /** 
  715. * This method is to take the pass out of the database and compare 
  716. * to a pass the user has typed in. 
  717. */ 
  718. public function authenticate_pass( $password, $serialized_pass ) 
  719. $pass_array = unserialize( $serialized_pass ); 
  720. return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) ); 
  721.  
  722. /** 
  723. * Translate the forum type from Kunena v3.x numeric's to WordPress's strings. 
  724. * @param int $status Kunena v3.x numeric forum type 
  725. * @return string WordPress safe 
  726. */ 
  727. public function callback_forum_type( $status = 0 ) { 
  728. if ( $status == 0 ) { 
  729. $status = 'category'; 
  730. } else { 
  731. $status = 'forum'; 
  732. return $status; 
  733.  
  734. /** 
  735. * Translate the forum status from Kunena v3.x numeric's to WordPress's strings. 
  736. * @param int $status Kunena v3.x numeric forum status 
  737. * @return string WordPress safe 
  738. */ 
  739. public function callback_forum_status( $status = 0 ) { 
  740. switch ( $status ) { 
  741. case 1 : 
  742. $status = 'closed'; 
  743. break; 
  744.  
  745. case 0 : 
  746. default : 
  747. $status = 'open'; 
  748. break; 
  749. return $status; 
  750.  
  751. /** 
  752. * Translate the post status from Kunena v3.x numeric's to WordPress's strings. 
  753. * @param int $status Kunena v3.x numeric topic status 
  754. * @return string WordPress safe 
  755. */ 
  756. public function callback_topic_status( $status = 0 ) { 
  757. switch ( $status ) { 
  758. case 1 : 
  759. $status = 'closed'; 
  760. break; 
  761.  
  762. case 0 : 
  763. default : 
  764. $status = 'publish'; 
  765. break; 
  766. return $status; 
  767.  
  768. /** 
  769. * Verify the topic/reply count. 
  770. * @param int $count Kunena v3.x topic/reply counts 
  771. * @return string WordPress safe 
  772. */ 
  773. public function callback_topic_reply_count( $count = 1 ) { 
  774. $count = absint( (int) $count - 1 ); 
  775. return $count; 
  776.  
  777. /** 
  778. * Set the reply title 
  779. * @param string $title Kunena v3.x topic title of this reply 
  780. * @return string Prefixed topic title, or empty string 
  781. */ 
  782. public function callback_reply_title( $title = '' ) { 
  783. $title = !empty( $title ) ? __( 'Re: ', 'bbpress' ) . html_entity_decode( $title ) : ''; 
  784. return $title;