bb_export_topic

The BuddyPress bb export topic function.

Description

bb_export_topic( $topic_id ); 

Parameters (1)

0. $topic_id
The topic id.

Usage

  1. if ( !function_exists( 'bb_export_topic' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-admin/export.php'; 
  3.  
  4. // The topic id. 
  5. $topic_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_export_topic($topic_id); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-admin/export.php  
  1. function bb_export_topic( $topic_id ) { 
  2. if ( !$_topic = get_topic( $topic_id ) ) 
  3. return; 
  4.  
  5. $_topic = get_object_vars( $_topic ); 
  6.  
  7. $atts = array( 
  8. 'type' => 'topic',  
  9. 'id' => $_topic['topic_id'],  
  10. 'author' => 'user_' . $_topic['topic_poster'],  
  11. 'in' => 'forum_' . $_topic['forum_id'] 
  12. ); 
  13.  
  14. $translate = array( 
  15. 'topic_title' => '!title',  
  16. 'topic_start_time' => 'incept',  
  17. 'topic_status' => '?status',  
  18. 'topic_id' => false,  
  19. 'topic_poster' => false,  
  20. 'topic_poster_name' => false,  
  21. 'topic_last_poster' => false,  
  22. 'topic_last_poster_name' => false,  
  23. 'topic_time' => false,  
  24. 'forum_id' => false,  
  25. 'topic_last_post_id' => false,  
  26. 'topic_posts' => false,  
  27. 'tag_count' => false 
  28. ); 
  29.  
  30. $topic = _bb_translate_for_export( $translate, $_topic ); 
  31.  
  32. $meta = array(); 
  33. foreach ( $_topic as $k => $v ) 
  34. $meta[$k] = maybe_serialize($v); 
  35. unset($_topic, $k, $v); 
  36.  
  37. $topic['meta'] = $meta; 
  38.  
  39. return _bb_export_object( $atts, $topic );