/includes/admin/forums.php

  1. <?php 
  2.  
  3. /** 
  4. * bbPress Forum Admin Class 
  5. * 
  6. * @package bbPress 
  7. * @subpackage Administration 
  8. */ 
  9.  
  10. // Exit if accessed directly 
  11. if ( !defined( 'ABSPATH' ) ) exit; 
  12.  
  13. if ( !class_exists( 'BBP_Forums_Admin' ) ) : 
  14. /** 
  15. * Loads bbPress forums admin area 
  16. * 
  17. * @package bbPress 
  18. * @subpackage Administration 
  19. * @since bbPress (r2464) 
  20. */ 
  21. class BBP_Forums_Admin { 
  22.  
  23. /** Variables *************************************************************/ 
  24.  
  25. /** 
  26. * @var The post type of this admin component 
  27. */ 
  28. private $post_type = ''; 
  29.  
  30. /** Functions *************************************************************/ 
  31.  
  32. /** 
  33. * The main bbPress forums admin loader 
  34. * 
  35. * @since bbPress (r2515) 
  36. * 
  37. * @uses BBP_Forums_Admin::setup_globals() Setup the globals needed 
  38. * @uses BBP_Forums_Admin::setup_actions() Setup the hooks and actions 
  39. * @uses BBP_Forums_Admin::setup_help() Setup the help text 
  40. */ 
  41. public function __construct() { 
  42. $this->setup_globals(); 
  43. $this->setup_actions(); 
  44.  
  45. /** 
  46. * Setup the admin hooks, actions and filters 
  47. * 
  48. * @since bbPress (r2646) 
  49. * @access private 
  50. * 
  51. * @uses add_action() To add various actions 
  52. * @uses add_filter() To add various filters 
  53. * @uses bbp_get_forum_post_type() To get the forum post type 
  54. * @uses bbp_get_topic_post_type() To get the topic post type 
  55. * @uses bbp_get_reply_post_type() To get the reply post type 
  56. */ 
  57. private function setup_actions() { 
  58.  
  59. // Add some general styling to the admin area 
  60. add_action( 'bbp_admin_head', array( $this, 'admin_head' ) ); 
  61.  
  62. // Messages 
  63. add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) ); 
  64.  
  65. // Metabox actions 
  66. add_action( 'add_meta_boxes', array( $this, 'attributes_metabox' ) ); 
  67. add_action( 'save_post', array( $this, 'attributes_metabox_save' ) ); 
  68.  
  69. // Column headers. 
  70. add_filter( 'manage_' . $this->post_type . '_posts_columns', array( $this, 'column_headers' ) ); 
  71.  
  72. // Columns (in page row) 
  73. add_action( 'manage_' . $this->post_type . '_posts_custom_column', array( $this, 'column_data' ), 10, 2 ); 
  74. add_filter( 'page_row_actions', array( $this, 'row_actions' ), 10, 2 ); 
  75.  
  76. // Contextual Help 
  77. add_action( 'load-edit.php', array( $this, 'edit_help' ) ); 
  78. add_action( 'load-post.php', array( $this, 'new_help' ) ); 
  79. add_action( 'load-post-new.php', array( $this, 'new_help' ) ); 
  80.  
  81. /** 
  82. * Should we bail out of this method? 
  83. * 
  84. * @since bbPress (r4067) 
  85. * @return boolean 
  86. */ 
  87. private function bail() { 
  88. if ( !isset( get_current_screen()->post_type ) || ( $this->post_type != get_current_screen()->post_type ) ) 
  89. return true; 
  90.  
  91. return false; 
  92.  
  93. /** 
  94. * Admin globals 
  95. * 
  96. * @since bbPress (r2646) 
  97. * @access private 
  98. */ 
  99. private function setup_globals() { 
  100. $this->post_type = bbp_get_forum_post_type(); 
  101.  
  102. /** Contextual Help *******************************************************/ 
  103.  
  104. /** 
  105. * Contextual help for bbPress forum edit page 
  106. * 
  107. * @since bbPress (r3119) 
  108. * @uses get_current_screen() 
  109. */ 
  110. public function edit_help() { 
  111.  
  112. if ( $this->bail() ) return; 
  113.  
  114. // Overview 
  115. get_current_screen()->add_help_tab( array( 
  116. 'id' => 'overview',  
  117. 'title' => __( 'Overview', 'bbpress' ),  
  118. 'content' => 
  119. '<p>' . __( 'This screen displays the individual forums on your site. You can customize the display of this screen to suit your workflow.', 'bbpress' ) . '</p>' 
  120. ) ); 
  121.  
  122. // Screen Content 
  123. get_current_screen()->add_help_tab( array( 
  124. 'id' => 'screen-content',  
  125. 'title' => __( 'Screen Content', 'bbpress' ),  
  126. 'content' => 
  127. '<p>' . __( 'You can customize the display of this screen’s contents in a number of ways:', 'bbpress' ) . '</p>' . 
  128. '<ul>' . 
  129. '<li>' . __( 'You can hide/display columns based on your needs and decide how many forums to list per screen using the Screen Options tab.', 'bbpress' ) . '</li>' . 
  130. '<li>' . __( 'You can filter the list of forums by forum status using the text links in the upper left to show All, Published, or Trashed forums. The default view is to show all forums.', 'bbpress' ) . '</li>' . 
  131. '<li>' . __( 'You can refine the list to show only forums from a specific month by using the dropdown menus above the forums list. Click the Filter button after making your selection. You also can refine the list by clicking on the forum creator in the forums list.', 'bbpress' ) . '</li>' . 
  132. '</ul>' 
  133. ) ); 
  134.  
  135. // Available Actions 
  136. get_current_screen()->add_help_tab( array( 
  137. 'id' => 'action-links',  
  138. 'title' => __( 'Available Actions', 'bbpress' ),  
  139. 'content' => 
  140. '<p>' . __( 'Hovering over a row in the forums list will display action links that allow you to manage your forum. You can perform the following actions:', 'bbpress' ) . '</p>' . 
  141. '<ul>' . 
  142. '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that forum. You can also reach that screen by clicking on the forum title.', 'bbpress' ) . '</li>' . 
  143. '<li>' . __( '<strong>Trash</strong> removes your forum from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' . 
  144. '<li>' . __( '<strong>View</strong> will show you what your draft forum will look like if you publish it. View will take you to your live site to view the forum. Which link is available depends on your forum’s status.', 'bbpress' ) . '</li>' . 
  145. '</ul>' 
  146. ) ); 
  147.  
  148. // Bulk Actions 
  149. get_current_screen()->add_help_tab( array( 
  150. 'id' => 'bulk-actions',  
  151. 'title' => __( 'Bulk Actions', 'bbpress' ),  
  152. 'content' => 
  153. '<p>' . __( 'You can also edit or move multiple forums to the trash at once. Select the forums you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.', 'bbpress' ) . '</p>' . 
  154. '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected forums at once. To remove a forum from the grouping, just click the x next to its name in the Bulk Edit area that appears.', 'bbpress' ) . '</p>' 
  155. ) ); 
  156.  
  157. // Help Sidebar 
  158. get_current_screen()->set_help_sidebar( 
  159. '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 
  160. '<p>' . __( '<a href="http://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . 
  161. '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>' 
  162. ); 
  163.  
  164. /** 
  165. * Contextual help for bbPress forum edit page 
  166. * 
  167. * @since bbPress (r3119) 
  168. * @uses get_current_screen() 
  169. */ 
  170. public function new_help() { 
  171.  
  172. if ( $this->bail() ) return; 
  173.  
  174. $customize_display = '<p>' . __( 'The title field and the big forum editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>'; 
  175.  
  176. get_current_screen()->add_help_tab( array( 
  177. 'id' => 'customize-display',  
  178. 'title' => __( 'Customizing This Display', 'bbpress' ),  
  179. 'content' => $customize_display,  
  180. ) ); 
  181.  
  182. get_current_screen()->add_help_tab( array( 
  183. 'id' => 'title-forum-editor',  
  184. 'title' => __( 'Title and Forum Editor', 'bbpress' ),  
  185. 'content' => 
  186. '<p>' . __( '<strong>Title</strong> - Enter a title for your forum. After you enter a title, you’ll see the permalink below, which you can edit.', 'bbpress' ) . '</p>' . 
  187. '<p>' . __( '<strong>Forum Editor</strong> - Enter the text for your forum. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your forum text. You can insert media files by clicking the icons above the forum editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular forum editor.', 'bbpress' ) . '</p>' 
  188. ) ); 
  189.  
  190. $publish_box = '<p>' . __( '<strong>Publish</strong> - You can set the terms of publishing your forum in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a forum or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a forum to be published in the future or backdate a forum.', 'bbpress' ) . '</p>'; 
  191.  
  192. if ( current_theme_supports( 'forum-thumbnails' ) && post_type_supports( 'forum', 'thumbnail' ) ) { 
  193. $publish_box .= '<p>' . __( '<strong>Featured Image</strong> - This allows you to associate an image with your forum without inserting it. This is usually useful only if your theme makes use of the featured image as a forum thumbnail on the home page, a custom header, etc.', 'bbpress' ) . '</p>'; 
  194.  
  195. get_current_screen()->add_help_tab( array( 
  196. 'id' => 'forum-attributes',  
  197. 'title' => __( 'Forum Attributes', 'bbpress' ),  
  198. 'content' => 
  199. '<p>' . __( 'Select the attributes that your forum should have:', 'bbpress' ) . '</p>' . 
  200. '<ul>' . 
  201. '<li>' . __( '<strong>Type</strong> indicates if the forum is a category or forum. Categories generally contain other forums.', 'bbpress' ) . '</li>' . 
  202. '<li>' . __( '<strong>Status</strong> allows you to close a forum to new topics and forums.', 'bbpress' ) . '</li>' . 
  203. '<li>' . __( '<strong>Visibility</strong> lets you pick the scope of each forum and what users are allowed to access it.', 'bbpress' ) . '</li>' . 
  204. '<li>' . __( '<strong>Parent</strong> dropdown determines the parent forum. Select the forum or category from the dropdown, or leave the default (No Parent) to create the forum at the root of your forums.', 'bbpress' ) . '</li>' . 
  205. '<li>' . __( '<strong>Order</strong> allows you to order your forums numerically.', 'bbpress' ) . '</li>' . 
  206. '</ul>' 
  207. ) ); 
  208.  
  209. get_current_screen()->add_help_tab( array( 
  210. 'id' => 'publish-box',  
  211. 'title' => __( 'Publish Box', 'bbpress' ),  
  212. 'content' => $publish_box,  
  213. ) ); 
  214.  
  215. get_current_screen()->set_help_sidebar( 
  216. '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 
  217. '<p>' . __( '<a href="http://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . 
  218. '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>' 
  219. ); 
  220.  
  221. /** 
  222. * Add the forum attributes metabox 
  223. * 
  224. * @since bbPress (r2746) 
  225. * 
  226. * @uses bbp_get_forum_post_type() To get the forum post type 
  227. * @uses add_meta_box() To add the metabox 
  228. * @uses do_action() Calls 'bbp_forum_attributes_metabox' 
  229. */ 
  230. public function attributes_metabox() { 
  231.  
  232. if ( $this->bail() ) return; 
  233.  
  234. add_meta_box ( 
  235. 'bbp_forum_attributes',  
  236. __( 'Forum Attributes', 'bbpress' ),  
  237. 'bbp_forum_metabox',  
  238. $this->post_type,  
  239. 'side',  
  240. 'high' 
  241. ); 
  242.  
  243. do_action( 'bbp_forum_attributes_metabox' ); 
  244.  
  245. /** 
  246. * Pass the forum attributes for processing 
  247. * 
  248. * @since bbPress (r2746) 
  249. * 
  250. * @param int $forum_id Forum id 
  251. * @uses current_user_can() To check if the current user is capable of 
  252. * editing the forum 
  253. * @uses bbp_get_forum() To get the forum 
  254. * @uses bbp_is_forum_closed() To check if the forum is closed 
  255. * @uses bbp_is_forum_category() To check if the forum is a category 
  256. * @uses bbp_is_forum_private() To check if the forum is private 
  257. * @uses bbp_close_forum() To close the forum 
  258. * @uses bbp_open_forum() To open the forum 
  259. * @uses bbp_categorize_forum() To make the forum a category 
  260. * @uses bbp_normalize_forum() To make the forum normal (not category) 
  261. * @uses bbp_privatize_forum() To mark the forum as private 
  262. * @uses bbp_publicize_forum() To mark the forum as public 
  263. * @uses do_action() Calls 'bbp_forum_attributes_metabox_save' with the 
  264. * forum id 
  265. * @return int Forum id 
  266. */ 
  267. public function attributes_metabox_save( $forum_id ) { 
  268.  
  269. if ( $this->bail() ) return $forum_id; 
  270.  
  271. // Bail if doing an autosave 
  272. if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 
  273. return $forum_id; 
  274.  
  275. // Bail if not a post request 
  276. if ( ! bbp_is_post_request() ) 
  277. return $forum_id; 
  278.  
  279. // Nonce check 
  280. if ( empty( $_POST['bbp_forum_metabox'] ) || !wp_verify_nonce( $_POST['bbp_forum_metabox'], 'bbp_forum_metabox_save' ) ) 
  281. return $forum_id; 
  282.  
  283. // Only save for forum post-types 
  284. if ( ! bbp_is_forum( $forum_id ) ) 
  285. return $forum_id; 
  286.  
  287. // Bail if current user cannot edit this forum 
  288. if ( !current_user_can( 'edit_forum', $forum_id ) ) 
  289. return $forum_id; 
  290.  
  291. // Parent ID 
  292. $parent_id = ( !empty( $_POST['parent_id'] ) && is_numeric( $_POST['parent_id'] ) ) ? (int) $_POST['parent_id'] : 0; 
  293.  
  294. // Update the forum meta bidness 
  295. bbp_update_forum( array( 
  296. 'forum_id' => $forum_id,  
  297. 'post_parent' => (int) $parent_id 
  298. ) ); 
  299.  
  300. do_action( 'bbp_forum_attributes_metabox_save', $forum_id ); 
  301.  
  302. return $forum_id; 
  303.  
  304. /** 
  305. * Add some general styling to the admin area 
  306. * 
  307. * @since bbPress (r2464) 
  308. * 
  309. * @uses bbp_get_forum_post_type() To get the forum post type 
  310. * @uses bbp_get_topic_post_type() To get the topic post type 
  311. * @uses bbp_get_reply_post_type() To get the reply post type 
  312. * @uses sanitize_html_class() To sanitize the classes 
  313. * @uses do_action() Calls 'bbp_admin_head' 
  314. */ 
  315. public function admin_head() { 
  316.  
  317. if ( $this->bail() ) return; 
  318.  
  319. ?> 
  320.  
  321. <style type="text/css" media="screen"> 
  322. /*<![CDATA[*/ 
  323.  
  324. #misc-publishing-actions,  
  325. #save-post { 
  326. display: none; 
  327.  
  328. strong.label { 
  329. display: inline-block; 
  330. width: 60px; 
  331.  
  332. #bbp_forum_attributes hr { 
  333. border-style: solid; 
  334. border-width: 1px; 
  335. border-color: #ccc #fff #fff #ccc; 
  336.  
  337. .column-bbp_forum_topic_count,  
  338. .column-bbp_forum_reply_count,  
  339. .column-bbp_topic_reply_count,  
  340. .column-bbp_topic_voice_count { 
  341. width: 8% !important; 
  342.  
  343. .column-author,  
  344. .column-bbp_reply_author,  
  345. .column-bbp_topic_author { 
  346. width: 10% !important; 
  347.  
  348. .column-bbp_topic_forum,  
  349. .column-bbp_reply_forum,  
  350. .column-bbp_reply_topic { 
  351. width: 10% !important; 
  352.  
  353. .column-bbp_forum_freshness,  
  354. .column-bbp_topic_freshness { 
  355. width: 10% !important; 
  356.  
  357. .column-bbp_forum_created,  
  358. .column-bbp_topic_created,  
  359. .column-bbp_reply_created { 
  360. width: 15% !important; 
  361.  
  362. .status-closed { 
  363. background-color: #eaeaea; 
  364.  
  365. .status-spam { 
  366. background-color: #faeaea; 
  367.  
  368. /*]]>*/ 
  369. </style> 
  370.  
  371. <?php 
  372.  
  373. /** 
  374. * Manage the column headers for the forums page 
  375. * 
  376. * @since bbPress (r2485) 
  377. * 
  378. * @param array $columns The columns 
  379. * @uses apply_filters() Calls 'bbp_admin_forums_column_headers' with 
  380. * the columns 
  381. * @return array $columns bbPress forum columns 
  382. */ 
  383. public function column_headers( $columns ) { 
  384.  
  385. if ( $this->bail() ) return $columns; 
  386.  
  387. $columns = array ( 
  388. 'cb' => '<input type="checkbox" />',  
  389. 'title' => __( 'Forum', 'bbpress' ),  
  390. 'bbp_forum_topic_count' => __( 'Topics', 'bbpress' ),  
  391. 'bbp_forum_reply_count' => __( 'Replies', 'bbpress' ),  
  392. 'author' => __( 'Creator', 'bbpress' ),  
  393. 'bbp_forum_created' => __( 'Created' , 'bbpress' ),  
  394. 'bbp_forum_freshness' => __( 'Freshness', 'bbpress' ) 
  395. ); 
  396.  
  397. return apply_filters( 'bbp_admin_forums_column_headers', $columns ); 
  398.  
  399. /** 
  400. * Print extra columns for the forums page 
  401. * 
  402. * @since bbPress (r2485) 
  403. * 
  404. * @param string $column Column 
  405. * @param int $forum_id Forum id 
  406. * @uses bbp_forum_topic_count() To output the forum topic count 
  407. * @uses bbp_forum_reply_count() To output the forum reply count 
  408. * @uses get_the_date() Get the forum creation date 
  409. * @uses get_the_time() Get the forum creation time 
  410. * @uses esc_attr() To sanitize the forum creation time 
  411. * @uses bbp_get_forum_last_active_time() To get the time when the forum was 
  412. * last active 
  413. * @uses do_action() Calls 'bbp_admin_forums_column_data' with the 
  414. * column and forum id 
  415. */ 
  416. public function column_data( $column, $forum_id ) { 
  417.  
  418. if ( $this->bail() ) return; 
  419.  
  420. switch ( $column ) { 
  421. case 'bbp_forum_topic_count' : 
  422. bbp_forum_topic_count( $forum_id ); 
  423. break; 
  424.  
  425. case 'bbp_forum_reply_count' : 
  426. bbp_forum_reply_count( $forum_id ); 
  427. break; 
  428.  
  429. case 'bbp_forum_created': 
  430. printf( '%1$s <br /> %2$s',  
  431. get_the_date(),  
  432. esc_attr( get_the_time() ) 
  433. ); 
  434.  
  435. break; 
  436.  
  437. case 'bbp_forum_freshness' : 
  438. $last_active = bbp_get_forum_last_active_time( $forum_id, false ); 
  439. if ( !empty( $last_active ) ) 
  440. echo esc_html( $last_active ); 
  441. else 
  442. esc_html_e( 'No Topics', 'bbpress' ); 
  443.  
  444. break; 
  445.  
  446. default: 
  447. do_action( 'bbp_admin_forums_column_data', $column, $forum_id ); 
  448. break; 
  449.  
  450. /** 
  451. * Forum Row actions 
  452. * 
  453. * Remove the quick-edit action link and display the description under 
  454. * the forum title 
  455. * 
  456. * @since bbPress (r2577) 
  457. * 
  458. * @param array $actions Actions 
  459. * @param array $forum Forum object 
  460. * @uses bbp_forum_content() To output forum description 
  461. * @return array $actions Actions 
  462. */ 
  463. public function row_actions( $actions, $forum ) { 
  464.  
  465. if ( $this->bail() ) return $actions; 
  466.  
  467. unset( $actions['inline hide-if-no-js'] ); 
  468.  
  469. // simple hack to show the forum description under the title 
  470. bbp_forum_content( $forum->ID ); 
  471.  
  472. return $actions; 
  473.  
  474. /** 
  475. * Custom user feedback messages for forum post type 
  476. * 
  477. * @since bbPress (r3080) 
  478. * 
  479. * @global int $post_ID 
  480. * @uses bbp_get_forum_permalink() 
  481. * @uses wp_post_revision_title() 
  482. * @uses esc_url() 
  483. * @uses add_query_arg() 
  484. * 
  485. * @param array $messages 
  486. * 
  487. * @return array 
  488. */ 
  489. public function updated_messages( $messages ) { 
  490. global $post_ID; 
  491.  
  492. if ( $this->bail() ) return $messages; 
  493.  
  494. // URL for the current forum 
  495. $forum_url = bbp_get_forum_permalink( $post_ID ); 
  496.  
  497. // Current forum's post_date 
  498. $post_date = bbp_get_global_post_field( 'post_date', 'raw' ); 
  499.  
  500. // Messages array 
  501. $messages[$this->post_type] = array( 
  502. 0 => '', // Left empty on purpose 
  503.  
  504. // Updated 
  505. 1 => sprintf( __( 'Forum updated. <a href="%s">View forum</a>', 'bbpress' ), $forum_url ),  
  506.  
  507. // Custom field updated 
  508. 2 => __( 'Custom field updated.', 'bbpress' ),  
  509.  
  510. // Custom field deleted 
  511. 3 => __( 'Custom field deleted.', 'bbpress' ),  
  512.  
  513. // Forum updated 
  514. 4 => __( 'Forum updated.', 'bbpress' ),  
  515.  
  516. // Restored from revision 
  517. // translators: %s: date and time of the revision 
  518. 5 => isset( $_GET['revision'] ) 
  519. ? sprintf( __( 'Forum restored to revision from %s', 'bbpress' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) 
  520. : false,  
  521.  
  522. // Forum created 
  523. 6 => sprintf( __( 'Forum created. <a href="%s">View forum</a>', 'bbpress' ), $forum_url ),  
  524.  
  525. // Forum saved 
  526. 7 => __( 'Forum saved.', 'bbpress' ),  
  527.  
  528. // Forum submitted 
  529. 8 => sprintf( __( 'Forum submitted. <a target="_blank" href="%s">Preview forum</a>', 'bbpress' ), esc_url( add_query_arg( 'preview', 'true', $forum_url ) ) ),  
  530.  
  531. // Forum scheduled 
  532. 9 => sprintf( __( 'Forum scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview forum</a>', 'bbpress' ),  
  533. // translators: Publish box date format, see http://php.net/date 
  534. date_i18n( __( 'M j, Y @ G:i', 'bbpress' ),  
  535. strtotime( $post_date ) ),  
  536. $forum_url ),  
  537.  
  538. // Forum draft updated 
  539. 10 => sprintf( __( 'Forum draft updated. <a target="_blank" href="%s">Preview forum</a>', 'bbpress' ), esc_url( add_query_arg( 'preview', 'true', $forum_url ) ) ),  
  540. ); 
  541.  
  542. return $messages; 
  543. endif; // class_exists check 
  544.  
  545. /** 
  546. * Setup bbPress Forums Admin 
  547. * 
  548. * This is currently here to make hooking and unhooking of the admin UI easy. 
  549. * It could use dependency injection in the future, but for now this is easier. 
  550. * 
  551. * @since bbPress (r2596) 
  552. * 
  553. * @uses BBP_Forums_Admin 
  554. */ 
  555. function bbp_admin_forums() { 
  556. bbpress()->admin->forums = new BBP_Forums_Admin(); 
.