Changeset 4053
- Timestamp:
- 07/04/2012 02:17:31 AM (12 years ago)
- Location:
- branches/plugin/bbp-admin
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-actions.php
r3966 r4053 49 49 50 50 // Hook on to admin_init 51 add_action( 'bbp_admin_init', 'bbp_admin_forums' , 9);52 add_action( 'bbp_admin_init', 'bbp_admin_topics' , 9);53 add_action( 'bbp_admin_init', 'bbp_admin_replies' , 9);51 add_action( 'bbp_admin_init', 'bbp_admin_forums' ); 52 add_action( 'bbp_admin_init', 'bbp_admin_topics' ); 53 add_action( 'bbp_admin_init', 'bbp_admin_replies' ); 54 54 add_action( 'bbp_admin_init', 'bbp_setup_updater', 999 ); 55 55 add_action( 'bbp_admin_init', 'bbp_register_importers' ); -
branches/plugin/bbp-admin/bbp-admin.php
r4052 r4053 77 77 78 78 /** 79 * Setup the admin hooks, actions and filters79 * Admin globals 80 80 * 81 81 * @since bbPress (r2646) 82 82 * @access private 83 * 84 * @uses add_action() To add various actions 85 * @uses add_filter() To add various filters 86 */ 87 private function setup_actions() { 88 89 /** General Actions ***************************************************/ 90 91 // Add menu item to settings menu 92 add_action( 'bbp_admin_menu', array( $this, 'admin_menus' ) ); 93 94 // Add some general styling to the admin area 95 add_action( 'bbp_admin_head', array( $this, 'admin_head' ) ); 96 97 // Add notice if not using a bbPress theme 98 add_action( 'bbp_admin_notices', array( $this, 'activation_notice' ) ); 99 100 // Add green admin style 101 add_action( 'bbp_register_admin_style', array( $this, 'register_admin_style' ) ); 102 103 // Add settings 104 add_action( 'bbp_register_admin_settings', array( $this, 'register_admin_settings' ) ); 105 106 // Add menu item to settings menu 107 add_action( 'bbp_activation', array( $this, 'new_install' ) ); 108 109 // Forums 'Right now' Dashboard widget 110 add_action( 'wp_dashboard_setup', array( $this, 'dashboard_widget_right_now' ) ); 111 112 /** Filters ***********************************************************/ 113 114 // Add link to settings page 115 add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 ); 116 117 /** Network Admin *****************************************************/ 118 119 // Add menu item to settings menu 120 add_action( 'network_admin_menu', array( $this, 'network_admin_menus' ) ); 121 122 /** Dependencies ******************************************************/ 123 124 // Allow plugins to modify these actions 125 do_action_ref_array( 'bbp_admin_loaded', array( &$this ) ); 83 */ 84 private function setup_globals() { 85 $bbp = bbpress(); 86 $this->admin_dir = trailingslashit( $bbp->plugin_dir . 'bbp-admin' ); // Admin path 87 $this->admin_url = trailingslashit( $bbp->plugin_url . 'bbp-admin' ); // Admin url 88 $this->images_url = trailingslashit( $this->admin_url . 'images' ); // Admin images URL 89 $this->styles_url = trailingslashit( $this->admin_url . 'styles' ); // Admin styles URL 126 90 } 127 91 … … 144 108 145 109 /** 146 * Admin globals110 * Setup the admin hooks, actions and filters 147 111 * 148 112 * @since bbPress (r2646) 149 113 * @access private 150 */ 151 private function setup_globals() { 152 $bbp = bbpress(); 153 $this->admin_dir = trailingslashit( $bbp->plugin_dir . 'bbp-admin' ); // Admin url 154 $this->admin_url = trailingslashit( $bbp->plugin_url . 'bbp-admin' ); // Admin url 155 $this->images_url = trailingslashit( $this->admin_url . 'images' ); // Admin images URL 156 $this->styles_url = trailingslashit( $this->admin_url . 'styles' ); // Admin styles URL 114 * 115 * @uses add_action() To add various actions 116 * @uses add_filter() To add various filters 117 */ 118 private function setup_actions() { 119 120 /** General Actions ***************************************************/ 121 122 add_action( 'bbp_admin_menu', array( $this, 'admin_menus' ) ); // Add menu item to settings menu 123 add_action( 'bbp_admin_head', array( $this, 'admin_head' ) ); // Add some general styling to the admin area 124 add_action( 'bbp_admin_notices', array( $this, 'activation_notice' ) ); // Add notice if not using a bbPress theme 125 add_action( 'bbp_register_admin_style', array( $this, 'register_admin_style' ) ); // Add green admin style 126 add_action( 'bbp_register_admin_settings', array( $this, 'register_admin_settings' ) ); // Add settings 127 add_action( 'bbp_activation', array( $this, 'new_install' ) ); // Add menu item to settings menu 128 add_action( 'wp_dashboard_setup', array( $this, 'dashboard_widget_right_now' ) ); // Forums 'Right now' Dashboard widget 129 130 /** Filters ***********************************************************/ 131 132 // Add link to settings page 133 add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 ); 134 135 /** Network Admin *****************************************************/ 136 137 // Add menu item to settings menu 138 add_action( 'network_admin_menu', array( $this, 'network_admin_menus' ) ); 139 140 /** Dependencies ******************************************************/ 141 142 // Allow plugins to modify these actions 143 do_action_ref_array( 'bbp_admin_loaded', array( &$this ) ); 157 144 } 158 145 … … 660 647 wp_admin_css_color( 'bbpress', __( 'Green', 'bbpress' ), $css_file, array( '#222222', '#006600', '#deece1', '#6eb469' ) ); 661 648 } 649 650 /** Updaters **************************************************************/ 662 651 663 652 /** -
branches/plugin/bbp-admin/bbp-converter.php
r4007 r4053 26 26 */ 27 27 public function __construct() { 28 29 // Bail if request is not correct 30 switch ( strtoupper( $_SERVER['REQUEST_METHOD'] ) ) { 31 32 // Converter is converting 33 case 'POST' : 34 if ( ( empty( $_POST['action'] ) || ( 'bbconverter_process' != $_POST['action'] ) ) ) 35 return; 36 37 break; 38 39 // Some other admin page 40 case 'GET' : 41 if ( ( empty( $_GET['page'] ) || ( 'bbp-converter' != $_GET['page'] ) ) ) 42 return; 43 44 break; 45 } 46 47 // Proceed with the actions 28 48 $this->setup_actions(); 29 49 } … … 61 81 62 82 // Add the main section 63 add_settings_section( 'bbpress_converter_main', __( ' Main Settings','bbpress' ), 'bbp_converter_setting_callback_main_section', 'bbpress_converter' );83 add_settings_section( 'bbpress_converter_main', __( 'Database Settings', 'bbpress' ), 'bbp_converter_setting_callback_main_section', 'bbpress_converter' ); 64 84 65 85 // System Select … … 140 160 border-color: #E6DB55; 141 161 font-family: monospace; 162 font-weight: bold; 142 163 } 143 164 … … 145 166 margin: 0.5em 0; 146 167 padding: 2px; 147 } 148 149 div.bbp-converter-updated p strong.loading { 150 padding: 2px 20px 2px 0; 168 float: left; 169 clear: left; 170 } 171 172 div.bbp-converter-updated p.loading { 173 padding: 2px 20px 2px 2px; 151 174 background-image: url('<?php echo admin_url(); ?>images/wpspin_light.gif'); 152 175 background-repeat: no-repeat; … … 186 209 187 210 values['action'] = 'bbconverter_process'; 211 values['_ajax_nonce'] = '<?php echo wp_create_nonce( 'bbp_converter_process' ); ?>'; 212 188 213 return values; 189 214 } … … 195 220 jQuery('#bbp-converter-stop').show(); 196 221 jQuery('#bbp-converter-progress').show(); 197 bbconverter_log( "Starting Conversion...");222 bbconverter_log( '<p class="loading"><?php _e( 'Starting Conversion', 'bbpress' ); ?></p>' ); 198 223 bbconverter_run(); 199 224 } … … 209 234 210 235 function bbconverter_stop() { 236 jQuery('#bbp-converter-start').show(); 237 jQuery('#bbp-converter-stop').hide(); 238 jQuery('#bbp-converter-progress').hide(); 239 jQuery('#bbp-converter-message p').removeClass( 'loading' ); 211 240 bbconverter_is_running = false; 212 jQuery('#bbp-converter-message strong').removeClass( 'loading');241 clearTimeout( bbconverter_run_timer ); 213 242 } 214 243 … … 216 245 bbconverter_log(response); 217 246 218 if ( response == 'Conversion Complete' || response.indexOf('error') > -1 ) { 219 bbconverter_log('<b>Repair any missing information: <a href="<?php echo admin_url(); ?>tools.php?page=bbp-repair">Continue</a></b>'); 220 jQuery('#bbp-converter-start').show(); 221 jQuery('#bbp-converter-stop').hide(); 222 jQuery('#bbp-converter-progress').hide(); 247 if ( response == '<p class="loading"><?php _e( 'Conversion Complete', 'bbpress' ); ?></p>' || response.indexOf('error') > -1 ) { 248 bbconverter_log('<p>Repair any missing information: <a href="<?php echo admin_url(); ?>tools.php?page=bbp-repair">Continue</a></p>'); 223 249 bbconverter_stop(); 224 clearTimeout( bbconverter_run_timer );225 250 } else if( bbconverter_is_running ) { // keep going 226 251 jQuery('#bbp-converter-progress').show(); … … 228 253 bbconverter_run_timer = setTimeout( 'bbconverter_run()', bbconverter_delay_time ); 229 254 } else { 230 jQuery('#bbp-converter-start').show(); 231 jQuery('#bbp-converter-stop').hide(); 232 jQuery('#bbp-converter-progress').hide(); 233 clearTimeout( bbconverter_run_timer ); 255 bbconverter_stop(); 234 256 } 235 257 } … … 240 262 } 241 263 if ( text ) { 242 jQuery('#bbp-converter-message strong').removeClass( 'loading' );243 jQuery('#bbp-converter-message').prepend( '<p><strong class="loading">' + text + '</strong></p>');264 jQuery('#bbp-converter-message p').removeClass( 'loading' ); 265 jQuery('#bbp-converter-message').prepend( text ); 244 266 } 245 267 } … … 251 273 252 274 /** 275 * Wrap the converter output in paragraph tags, so styling can be applied 276 * 277 * @since bbPress (r4052) 278 * 279 * @param string $output 280 */ 281 private static function converter_output( $output = '' ) { 282 283 // Get the last query 284 $before = '<p class="loading">'; 285 $after = '</p>'; 286 $query = get_option( '_bbp_converter_query' ); 287 288 if ( ! empty( $query ) ) 289 $before = '<p class="loading" title="' . esc_attr( $query ) . '">'; 290 291 echo $before . $output . $after; 292 } 293 294 /** 253 295 * Callback processor 254 296 * … … 256 298 */ 257 299 public function process_callback() { 300 301 // Verify intent 302 check_ajax_referer( 'bbp_converter_process' ); 258 303 259 304 if ( ! ini_get( 'safe_mode' ) ) { … … 294 339 $this->sync_table(); 295 340 if ( empty( $start ) ) { 296 _e( 'No data to clean', 'bbpress');341 $this->converter_output( __( 'No data to clean', 'bbpress' ) ); 297 342 } 298 343 } else { 299 344 update_option( '_bbp_converter_start', $max + 1 ); 300 printf( __( 'Deleting previously converted data (%1$s - %2$s)', 'bbpress' ), $min, $max);345 $this->converter_output( sprintf( __( 'Deleting previously converted data (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 301 346 } 302 347 } else { … … 314 359 update_option( '_bbp_converter_start', 0 ); 315 360 if ( empty( $start ) ) { 316 _e( 'No users to convert', 'bbpress');361 $this->converter_output( __( 'No users to convert', 'bbpress' ) ); 317 362 } 318 363 } else { 319 364 update_option( '_bbp_converter_start', $max + 1 ); 320 printf( __( 'Converting users (%1$s - %2$s)', 'bbpress' ), $min, $max);365 $this->converter_output( sprintf( __( 'Converting users (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 321 366 } 322 367 } else { … … 334 379 update_option( '_bbp_converter_start', 0 ); 335 380 if ( empty( $start ) ) { 336 _e( 'No passwords to clear', 'bbpress');381 $this->converter_output( __( 'No passwords to clear', 'bbpress' ) ); 337 382 } 338 383 } else { 339 384 update_option( '_bbp_converter_start', $max + 1 ); 340 printf( __( 'Delete users wordpress default passwords (%1$s - %2$s)', 'bbpress' ), $min, $max);385 $this->converter_output( sprintf( __( 'Delete users wordpress default passwords (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 341 386 } 342 387 } else { … … 353 398 update_option( '_bbp_converter_start', 0 ); 354 399 if ( empty( $start ) ) { 355 _e( 'No forums to convert', 'bbpress');400 $this->converter_output( __( 'No forums to convert', 'bbpress' ) ); 356 401 } 357 402 } else { 358 403 update_option( '_bbp_converter_start', $max + 1 ); 359 printf( __( 'Converting forums (%1$s - %2$s)', 'bbpress' ), $min, $max);404 $this->converter_output( sprintf( __( 'Converting forums (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 360 405 } 361 406 … … 364 409 // STEP 5. Convert forum parents. 365 410 case 5 : 366 367 411 if ( $converter->convert_forum_parents( $start ) ) { 368 412 update_option( '_bbp_converter_step', $step + 1 ); 369 413 update_option( '_bbp_converter_start', 0 ); 370 414 if ( empty( $start ) ) { 371 _e( 'No forum parents to convert', 'bbpress');415 $this->converter_output( __( 'No forum parents to convert', 'bbpress' ) ); 372 416 } 373 417 } else { 374 418 update_option( '_bbp_converter_start', $max + 1 ); 375 printf( __( 'Calculating forum hierarchy (%1$s - %2$s)', 'bbpress' ), $min, $max);419 $this->converter_output( sprintf( __( 'Calculating forum hierarchy (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 376 420 } 377 421 … … 380 424 // STEP 6. Convert topics. 381 425 case 6 : 382 383 426 if ( $converter->convert_topics( $start ) ) { 384 427 update_option( '_bbp_converter_step', $step + 1 ); 385 428 update_option( '_bbp_converter_start', 0 ); 386 429 if ( empty( $start ) ) { 387 _e( 'No topics to convert', 'bbpress');430 $this->converter_output( __( 'No topics to convert', 'bbpress' ) ); 388 431 } 389 432 } else { 390 433 update_option( '_bbp_converter_start', $max + 1 ); 391 printf( __( 'Converting topics (%1$s - %2$s)', 'bbpress' ), $min, $max);434 $this->converter_output( sprintf( __( 'Converting topics (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 392 435 } 393 436 … … 396 439 // STEP 7. Convert tags. 397 440 case 7 : 398 399 441 if ( $converter->convert_tags( $start ) ) { 400 442 update_option( '_bbp_converter_step', $step + 1 ); 401 443 update_option( '_bbp_converter_start', 0 ); 402 444 if ( empty( $start ) ) { 403 _e( 'No tags to convert', 'bbpress');445 $this->converter_output( __( 'No tags to convert', 'bbpress' ) ); 404 446 } 405 447 } else { 406 448 update_option( '_bbp_converter_start', $max + 1 ); 407 printf( __( 'Converting topic tags (%1$s - %2$s)', 'bbpress' ), $min, $max);449 $this->converter_output( sprintf( __( 'Converting topic tags (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 408 450 } 409 451 … … 416 458 update_option( '_bbp_converter_start', 0 ); 417 459 if ( empty( $start ) ) { 418 _e( 'No replies to convert', 'bbpress');460 $this->converter_output( __( 'No replies to convert', 'bbpress' ) ); 419 461 } 420 462 } else { 421 463 update_option( '_bbp_converter_start', $max + 1 ); 422 printf( __( 'Converting replies (%1$s - %2$s)', 'bbpress' ), $min, $max);464 $this->converter_output( sprintf( __( 'Converting replies (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 423 465 } 424 466 … … 426 468 427 469 default : 428 delete_option( '_bbp_converter_step' );470 delete_option( '_bbp_converter_step' ); 429 471 delete_option( '_bbp_converter_start' ); 430 431 _e( 'Conversion Complete', 'bbpress' ); 472 delete_option( '_bbp_converter_query' ); 473 474 $this->converter_output( __( 'Conversion Complete', 'bbpress' ) ); 432 475 433 476 break; 434 435 477 } 436 478 } … … 813 855 $forum_array = $this->opdb->get_results( $forum_query, ARRAY_A ); 814 856 815 // Output the query, for better debugging816 printf( __( '<span title="%s">View Query</span>%s', 'bbpress' ), esc_attr( $forum_query ), '<br />');857 // Set this query as the last one ran 858 update_option( '_bbp_converter_query', $forum_query ); 817 859 818 860 // Query returned some results … … 958 1000 959 1001 public function convert_forum_parents( $start ) { 1002 960 1003 $has_update = false; 961 1004 962 if ( !empty( $this->sync_table ) ) { 963 $forum_array = $this->wpdb->get_results( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_forum_parent_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows ); 964 } else { 965 $forum_array = $this->wpdb->get_results( 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_forum_parent_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows ); 966 } 1005 if ( !empty( $this->sync_table ) ) 1006 $query = 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_forum_parent_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows; 1007 else 1008 $query = 'SELECT post_id AS value_id, meta_value FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_forum_parent_id" AND meta_value > 0 LIMIT ' . $start . ', ' . $this->max_rows; 1009 1010 update_option( '_bbp_converter_query', $query ); 1011 1012 $forum_array = $this->wpdb->get_results( $query ); 967 1013 968 1014 foreach ( (array) $forum_array as $row ) { … … 979 1025 */ 980 1026 public function clean( $start ) { 1027 981 1028 $start = 0; 982 1029 $has_delete = false; … … 984 1031 /** Delete bbconverter topics/forums/posts ****************************/ 985 1032 986 if ( true === $this->sync_table ) { 987 $bbconverter = $this->wpdb->get_results( 'SELECT value_id FROM ' . $this->sync_table_name . ' INNER JOIN ' . $this->wpdb->posts . ' ON(value_id = ID) WHERE meta_key LIKE "_bbp_%" AND value_type = "post" GROUP BY value_id ORDER BY value_id DESC LIMIT ' . $this->max_rows, ARRAY_A ); 988 } else { 989 $bbconverter = $this->wpdb->get_results( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key LIKE "_bbp_%" GROUP BY post_id ORDER BY post_id DESC LIMIT ' . $this->max_rows, ARRAY_A ); 990 } 991 992 if ( !empty( $bbconverter ) ) { 993 foreach ( (array) $bbconverter as $value ) { 1033 if ( true === $this->sync_table ) 1034 $query = 'SELECT value_id FROM ' . $this->sync_table_name . ' INNER JOIN ' . $this->wpdb->posts . ' ON(value_id = ID) WHERE meta_key LIKE "_bbp_%" AND value_type = "post" GROUP BY value_id ORDER BY value_id DESC LIMIT ' . $this->max_rows; 1035 else 1036 $query = 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key LIKE "_bbp_%" GROUP BY post_id ORDER BY post_id DESC LIMIT ' . $this->max_rows; 1037 1038 update_option( '_bbp_converter_query', $query ); 1039 1040 $posts = $this->wpdb->get_results( $query, ARRAY_A ); 1041 1042 if ( !empty( $posts ) ) { 1043 foreach ( (array) $posts as $value ) { 994 1044 wp_delete_post( $value['value_id'], true ); 995 1045 } … … 999 1049 /** Delete bbconverter users ******************************************/ 1000 1050 1001 if ( true === $this->sync_table ) { 1002 $bbconverter = $this->wpdb->get_results( 'SELECT value_id FROM ' . $this->sync_table_name . ' INNER JOIN ' . $this->wpdb->users . ' ON(value_id = ID) WHERE meta_key = "_bbp_user_id" AND value_type = "user" LIMIT ' . $this->max_rows, ARRAY_A ); 1003 } else { 1004 $bbconverter = $this->wpdb->get_results( 'SELECT user_id AS value_id FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_user_id" LIMIT ' . $this->max_rows, ARRAY_A ); 1005 } 1006 1007 if ( !empty( $bbconverter ) ) { 1008 foreach ( $bbconverter as $value ) { 1051 if ( true === $this->sync_table ) 1052 $query = 'SELECT value_id FROM ' . $this->sync_table_name . ' INNER JOIN ' . $this->wpdb->users . ' ON(value_id = ID) WHERE meta_key = "_bbp_user_id" AND value_type = "user" LIMIT ' . $this->max_rows; 1053 else 1054 $query = 'SELECT user_id AS value_id FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_user_id" LIMIT ' . $this->max_rows; 1055 1056 update_option( '_bbp_converter_query', $query ); 1057 1058 $users = $this->wpdb->get_results( $query, ARRAY_A ); 1059 1060 if ( !empty( $users ) ) { 1061 foreach ( $users as $value ) { 1009 1062 wp_delete_user( $value['value_id'] ); 1010 1063 } … … 1012 1065 } 1013 1066 1067 unset( $posts ); 1068 unset( $users ); 1069 1014 1070 return ! $has_delete; 1015 1071 } … … 1021 1077 */ 1022 1078 public function clean_passwords( $start ) { 1079 1023 1080 $has_delete = false; 1024 1081 1025 1082 /** Delete bbconverter passwords **************************************/ 1026 1083 1027 $bbconverter = $this->wpdb->get_results( 'SELECT user_id, meta_value FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" LIMIT ' . $start . ', ' . $this->max_rows, ARRAY_A ); 1084 $query = 'SELECT user_id, meta_value FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" LIMIT ' . $start . ', ' . $this->max_rows; 1085 update_option( '_bbp_converter_query', $query ); 1086 1087 $bbconverter = $this->wpdb->get_results( $query, ARRAY_A ); 1088 1028 1089 if ( !empty( $bbconverter ) ) { 1029 1090 … … 1038 1099 $has_delete = true; 1039 1100 } 1101 1040 1102 return ! $has_delete; 1041 1103 } -
branches/plugin/bbp-admin/bbp-forums.php
r4034 r4053 26 26 * @var The post type of this admin component 27 27 */ 28 var$post_type = '';28 private $post_type = ''; 29 29 30 30 /** Functions *************************************************************/ … … 102 102 public function edit_help() { 103 103 104 $current_screen = get_current_screen();105 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';106 107 // Bail if current screen could not be found108 if ( empty( $current_screen ) )109 return;110 111 // Bail if not the forum post type112 if ( $post_type != $this->post_type )113 return;114 115 104 // Overview 116 $current_screen->add_help_tab( array(105 get_current_screen()->add_help_tab( array( 117 106 'id' => 'overview', 118 107 'title' => __( 'Overview', 'bbpress' ), … … 122 111 123 112 // Screen Content 124 $current_screen->add_help_tab( array(113 get_current_screen()->add_help_tab( array( 125 114 'id' => 'screen-content', 126 115 'title' => __( 'Screen Content', 'bbpress' ), … … 136 125 137 126 // Available Actions 138 $current_screen->add_help_tab( array(127 get_current_screen()->add_help_tab( array( 139 128 'id' => 'action-links', 140 129 'title' => __( 'Available Actions', 'bbpress' ), … … 151 140 152 141 // Bulk Actions 153 $current_screen->add_help_tab( array(142 get_current_screen()->add_help_tab( array( 154 143 'id' => 'bulk-actions', 155 144 'title' => __( 'Bulk Actions', 'bbpress' ), … … 160 149 161 150 // Help Sidebar 162 $current_screen->set_help_sidebar(151 get_current_screen()->set_help_sidebar( 163 152 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 164 153 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 175 164 public function new_help() { 176 165 177 $current_screen = get_current_screen();178 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';179 180 // Bail if current screen could not be found181 if ( empty( $current_screen ) )182 return;183 184 // Bail if not the forum post type185 if ( $post_type != $this->post_type )186 return;187 188 166 $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>'; 189 167 190 $current_screen->add_help_tab( array(168 get_current_screen()->add_help_tab( array( 191 169 'id' => 'customize-display', 192 170 'title' => __( 'Customizing This Display', 'bbpress' ), … … 194 172 ) ); 195 173 196 $current_screen->add_help_tab( array(174 get_current_screen()->add_help_tab( array( 197 175 'id' => 'title-forum-editor', 198 176 'title' => __( 'Title and Forum Editor', 'bbpress' ), … … 212 190 } 213 191 214 $current_screen->add_help_tab( array(192 get_current_screen()->add_help_tab( array( 215 193 'id' => 'forum-attributes', 216 194 'title' => __( 'Forum Attributes', 'bbpress' ), … … 226 204 ) ); 227 205 228 $current_screen->add_help_tab( array(206 get_current_screen()->add_help_tab( array( 229 207 'id' => 'publish-box', 230 208 'title' => __( 'Publish Box', 'bbpress' ), … … 232 210 ) ); 233 211 234 $current_screen->add_help_tab( array(212 get_current_screen()->add_help_tab( array( 235 213 'id' => 'discussion-settings', 236 214 'title' => __( 'Discussion Settings', 'bbpress' ), … … 240 218 ) ); 241 219 242 $current_screen->set_help_sidebar(220 get_current_screen()->set_help_sidebar( 243 221 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 244 222 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 309 287 return $forum_id; 310 288 311 // Bail if post_type is not a topic or reply312 if ( get_post_type( $forum_id ) != $this->post_type )313 return $forum_id;314 315 289 // Parent ID 316 290 $parent_id = ( !empty( $_POST['parent_id'] ) && is_numeric( $_POST['parent_id'] ) ) ? (int) $_POST['parent_id'] : 0; … … 339 313 */ 340 314 function admin_head() { 341 342 if ( get_post_type() == $this->post_type ) : ?> 343 344 <style type="text/css" media="screen"> 345 /*<![CDATA[*/ 346 347 #misc-publishing-actions, 348 #save-post { 349 display: none; 350 } 351 352 strong.label { 353 display: inline-block; 354 width: 60px; 355 } 356 357 #bbp_forum_attributes hr { 358 border-style: solid; 359 border-width: 1px; 360 border-color: #ccc #fff #fff #ccc; 361 } 362 363 .column-bbp_forum_topic_count, 364 .column-bbp_forum_reply_count, 365 .column-bbp_topic_reply_count, 366 .column-bbp_topic_voice_count { 367 width: 8% !important; 368 } 369 370 .column-author, 371 .column-bbp_reply_author, 372 .column-bbp_topic_author { 373 width: 10% !important; 374 } 375 376 .column-bbp_topic_forum, 377 .column-bbp_reply_forum, 378 .column-bbp_reply_topic { 379 width: 10% !important; 380 } 381 382 .column-bbp_forum_freshness, 383 .column-bbp_topic_freshness { 384 width: 10% !important; 385 } 386 387 .column-bbp_forum_created, 388 .column-bbp_topic_created, 389 .column-bbp_reply_created { 390 width: 15% !important; 391 } 392 393 .status-closed { 394 background-color: #eaeaea; 395 } 396 397 .status-spam { 398 background-color: #faeaea; 399 } 400 401 /*]]>*/ 402 </style> 403 404 <?php endif; ?> 315 ?> 316 317 <style type="text/css" media="screen"> 318 /*<![CDATA[*/ 319 320 #misc-publishing-actions, 321 #save-post { 322 display: none; 323 } 324 325 strong.label { 326 display: inline-block; 327 width: 60px; 328 } 329 330 #bbp_forum_attributes hr { 331 border-style: solid; 332 border-width: 1px; 333 border-color: #ccc #fff #fff #ccc; 334 } 335 336 .column-bbp_forum_topic_count, 337 .column-bbp_forum_reply_count, 338 .column-bbp_topic_reply_count, 339 .column-bbp_topic_voice_count { 340 width: 8% !important; 341 } 342 343 .column-author, 344 .column-bbp_reply_author, 345 .column-bbp_topic_author { 346 width: 10% !important; 347 } 348 349 .column-bbp_topic_forum, 350 .column-bbp_reply_forum, 351 .column-bbp_reply_topic { 352 width: 10% !important; 353 } 354 355 .column-bbp_forum_freshness, 356 .column-bbp_topic_freshness { 357 width: 10% !important; 358 } 359 360 .column-bbp_forum_created, 361 .column-bbp_topic_created, 362 .column-bbp_reply_created { 363 width: 15% !important; 364 } 365 366 .status-closed { 367 background-color: #eaeaea; 368 } 369 370 .status-spam { 371 background-color: #faeaea; 372 } 373 374 /*]]>*/ 375 </style> 405 376 406 377 <?php … … 495 466 */ 496 467 function row_actions( $actions, $forum ) { 497 if ( $forum->post_type == $this->post_type ) { 498 unset( $actions['inline hide-if-no-js'] ); 499 500 // simple hack to show the forum description under the title 501 bbp_forum_content( $forum->ID ); 502 } 468 unset( $actions['inline hide-if-no-js'] ); 469 470 // simple hack to show the forum description under the title 471 bbp_forum_content( $forum->ID ); 503 472 504 473 return $actions; … … 511 480 * 512 481 * @global int $post_ID 513 * @uses get_post_type()514 482 * @uses bbp_get_forum_permalink() 515 483 * @uses wp_post_revision_title() … … 523 491 function updated_messages( $messages ) { 524 492 global $post_ID; 525 526 if ( get_post_type( $post_ID ) != $this->post_type )527 return $messages;528 493 529 494 // URL for the current forum … … 583 548 * Setup bbPress Forums Admin 584 549 * 550 * This is currently here to make hooking and unhooking of the admin UI easy. 551 * It could use dependency injection in the future, but for now this is easier. 552 * 585 553 * @since bbPress (r2596) 586 554 * … … 588 556 */ 589 557 function bbp_admin_forums() { 558 global $typenow; 559 560 if ( bbp_get_forum_post_type() != $typenow ) 561 return; 562 590 563 bbpress()->admin->forums = new BBP_Forums_Admin(); 591 564 } -
branches/plugin/bbp-admin/bbp-replies.php
r4034 r4053 26 26 * @var The post type of this admin component 27 27 */ 28 var$post_type = '';28 private $post_type = ''; 29 29 30 30 /** Functions *************************************************************/ … … 76 76 77 77 // Check if there are any bbp_toggle_reply_* requests on admin_init, also have a message displayed 78 add_action( ' bbp_admin_init',array( $this, 'toggle_reply' ) );78 add_action( 'load-edit.php', array( $this, 'toggle_reply' ) ); 79 79 add_action( 'admin_notices', array( $this, 'toggle_reply_notice' ) ); 80 80 … … 114 114 public function edit_help() { 115 115 116 $current_screen = get_current_screen();117 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';118 119 // Bail if current screen could not be found120 if ( empty( $current_screen ) )121 return;122 123 // Bail if not the reply post type124 if ( $post_type != $this->post_type )125 return;126 127 116 // Overview 128 $current_screen->add_help_tab( array(117 get_current_screen()->add_help_tab( array( 129 118 'id' => 'overview', 130 119 'title' => __( 'Overview', 'bbpress' ), … … 134 123 135 124 // Screen Content 136 $current_screen->add_help_tab( array(125 get_current_screen()->add_help_tab( array( 137 126 'id' => 'screen-content', 138 127 'title' => __( 'Screen Content', 'bbpress' ), … … 148 137 149 138 // Available Actions 150 $current_screen->add_help_tab( array(139 get_current_screen()->add_help_tab( array( 151 140 'id' => 'action-links', 152 141 'title' => __( 'Available Actions', 'bbpress' ), … … 163 152 164 153 // Bulk Actions 165 $current_screen->add_help_tab( array(154 get_current_screen()->add_help_tab( array( 166 155 'id' => 'bulk-actions', 167 156 'title' => __( 'Bulk Actions', 'bbpress' ), … … 172 161 173 162 // Help Sidebar 174 $current_screen->set_help_sidebar(163 get_current_screen()->set_help_sidebar( 175 164 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 176 165 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 187 176 public function new_help() { 188 177 189 $current_screen = get_current_screen();190 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';191 192 // Bail if current screen could not be found193 if ( empty( $current_screen ) )194 return;195 196 // Bail if not the reply post type197 if ( $post_type != $this->post_type )198 return;199 200 178 $customize_display = '<p>' . __( 'The title field and the big reply 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>'; 201 179 202 $current_screen->add_help_tab( array(180 get_current_screen()->add_help_tab( array( 203 181 'id' => 'customize-display', 204 182 'title' => __( 'Customizing This Display', 'bbpress' ), … … 206 184 ) ); 207 185 208 $current_screen->add_help_tab( array(186 get_current_screen()->add_help_tab( array( 209 187 'id' => 'title-reply-editor', 210 188 'title' => __( 'Title and Reply Editor', 'bbpress' ), … … 224 202 } 225 203 226 $current_screen->add_help_tab( array(204 get_current_screen()->add_help_tab( array( 227 205 'id' => 'reply-attributes', 228 206 'title' => __( 'Reply Attributes', 'bbpress' ), … … 235 213 ) ); 236 214 237 $current_screen->add_help_tab( array(215 get_current_screen()->add_help_tab( array( 238 216 'id' => 'publish-box', 239 217 'title' => __( 'Publish Box', 'bbpress' ), … … 241 219 ) ); 242 220 243 $current_screen->add_help_tab( array(221 get_current_screen()->add_help_tab( array( 244 222 'id' => 'discussion-settings', 245 223 'title' => __( 'Discussion Settings', 'bbpress' ), … … 249 227 ) ); 250 228 251 $current_screen->set_help_sidebar(229 get_current_screen()->set_help_sidebar( 252 230 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 253 231 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 308 286 return $reply_id; 309 287 310 // Bail if post_type is not a reply311 if ( get_post_type( $reply_id ) != $this->post_type )312 return $reply_id;313 314 288 // Current user cannot edit this reply 315 289 if ( !current_user_can( 'edit_reply', $reply_id ) ) … … 347 321 348 322 // Bail if post_type is not a reply 349 if ( ( empty( $_GET['action'] ) || ( 'edit' != $_GET['action'] ) ) || ( get_post_type() != $this->post_type) )323 if ( empty( $_GET['action'] ) || ( 'edit' != $_GET['action'] ) ) 350 324 return; 351 325 … … 393 367 return $post_id; 394 368 395 // Bail if post_type is not a topic or reply396 if ( get_post_type( $post_id ) != $this->post_type )397 return;398 399 369 // Bail if user cannot edit replies or reply is not anonymous 400 370 if ( !current_user_can( 'edit_reply', $post_id ) ) … … 424 394 */ 425 395 function admin_head() { 426 427 if ( get_post_type() == $this->post_type ) : ?> 428 429 <style type="text/css" media="screen"> 430 /*<![CDATA[*/ 431 432 .column-bbp_forum_topic_count, 433 .column-bbp_forum_reply_count, 434 .column-bbp_topic_reply_count, 435 .column-bbp_topic_voice_count { 436 width: 8% !important; 437 } 438 439 .column-author, 440 .column-bbp_reply_author, 441 .column-bbp_topic_author { 442 width: 10% !important; 443 } 444 445 .column-bbp_topic_forum, 446 .column-bbp_reply_forum, 447 .column-bbp_reply_topic { 448 width: 10% !important; 449 } 450 451 .column-bbp_forum_freshness, 452 .column-bbp_topic_freshness { 453 width: 10% !important; 454 } 455 456 .column-bbp_forum_created, 457 .column-bbp_topic_created, 458 .column-bbp_reply_created { 459 width: 15% !important; 460 } 461 462 .status-closed { 463 background-color: #eaeaea; 464 } 465 466 .status-spam { 467 background-color: #faeaea; 468 } 469 470 /*]]>*/ 471 </style> 472 473 <?php endif; 474 396 ?> 397 398 <style type="text/css" media="screen"> 399 /*<![CDATA[*/ 400 401 .column-bbp_forum_topic_count, 402 .column-bbp_forum_reply_count, 403 .column-bbp_topic_reply_count, 404 .column-bbp_topic_voice_count { 405 width: 8% !important; 406 } 407 408 .column-author, 409 .column-bbp_reply_author, 410 .column-bbp_topic_author { 411 width: 10% !important; 412 } 413 414 .column-bbp_topic_forum, 415 .column-bbp_reply_forum, 416 .column-bbp_reply_topic { 417 width: 10% !important; 418 } 419 420 .column-bbp_forum_freshness, 421 .column-bbp_topic_freshness { 422 width: 10% !important; 423 } 424 425 .column-bbp_forum_created, 426 .column-bbp_topic_created, 427 .column-bbp_reply_created { 428 width: 15% !important; 429 } 430 431 .status-closed { 432 background-color: #eaeaea; 433 } 434 435 .status-spam { 436 background-color: #faeaea; 437 } 438 439 /*]]>*/ 440 </style> 441 442 <?php 475 443 } 476 444 … … 815 783 function filter_dropdown() { 816 784 817 // Bail if not viewing the topics list818 if (819 // post_type exists in _GET820 empty( $_GET['post_type'] ) ||821 822 // post_type is reply or topic type823 ( $_GET['post_type'] != $this->post_type )824 )825 return;826 827 785 // Add Empty Spam button 828 786 if ( !empty( $_GET['post_status'] ) && ( bbp_get_spam_status_id() == $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { … … 856 814 global $pagenow; 857 815 858 // Avoid poisoning other requests859 if (860 // Only look in admin861 !is_admin() ||862 863 // Make sure the current page is for post rows864 ( 'edit.php' != $pagenow ) ||865 866 // Make sure we're looking for a post_type867 empty( $_GET['post_type'] ) ||868 869 // Make sure we're looking at bbPress topics870 ( $_GET['post_type'] != $this->post_type )871 )872 873 // We're in no shape to filter anything, so return874 return $query_vars;875 876 816 // Add post_parent query_var if one is present 877 817 if ( !empty( $_GET['bbp_forum_id'] ) ) { … … 890 830 * 891 831 * @global int $post_ID 892 * @uses get_post_type()893 832 * @uses bbp_get_topic_permalink() 894 833 * @uses wp_post_revision_title() … … 902 841 function updated_messages( $messages ) { 903 842 global $post_ID; 904 905 if ( get_post_type( $post_ID ) != $this->post_type )906 return $messages;907 843 908 844 // URL for the current topic … … 962 898 * Setup bbPress Replies Admin 963 899 * 900 * This is currently here to make hooking and unhooking of the admin UI easy. 901 * It could use dependency injection in the future, but for now this is easier. 902 * 964 903 * @since bbPress (r2596) 965 904 * … … 967 906 */ 968 907 function bbp_admin_replies() { 908 global $typenow; 909 910 if ( bbp_get_reply_post_type() == $typenow ) 911 return; 912 969 913 bbpress()->admin->replies = new BBP_Replies_Admin(); 970 914 } -
branches/plugin/bbp-admin/bbp-settings.php
r4048 r4053 1146 1146 1147 1147 <input id="_bbp_converter_restart" name="_bbp_converter_restart" type="checkbox" id="_bbp_converter_restart" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> /> 1148 <label for="_bbp_converter_restart"><?php _e( 'Restart the conversion process', 'bbpress' ); ?></label>1148 <label for="_bbp_converter_restart"><?php _e( 'Restart conversion from the beginning', 'bbpress' ); ?></label> 1149 1149 <p class="description"><?php _e( 'The importer keeps track of where it left off in the event of failure.', 'bbpress' ); ?></p> 1150 1150 -
branches/plugin/bbp-admin/bbp-topics.php
r4034 r4053 26 26 * @var The post type of this admin component 27 27 */ 28 var$post_type = '';28 private $post_type = ''; 29 29 30 30 /** Functions *************************************************************/ … … 76 76 77 77 // Check if there are any bbp_toggle_topic_* requests on admin_init, also have a message displayed 78 add_action( ' bbp_admin_init',array( $this, 'toggle_topic' ) );78 add_action( 'load-edit.php', array( $this, 'toggle_topic' ) ); 79 79 add_action( 'admin_notices', array( $this, 'toggle_topic_notice' ) ); 80 80 … … 114 114 public function edit_help() { 115 115 116 $current_screen = get_current_screen();117 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';118 119 // Bail if current screen could not be found120 if ( empty( $current_screen ) )121 return;122 123 // Bail if not the topic post type124 if ( $post_type != $this->post_type )125 return;126 127 116 // Overview 128 $current_screen->add_help_tab( array(117 get_current_screen()->add_help_tab( array( 129 118 'id' => 'overview', 130 119 'title' => __( 'Overview', 'bbpress' ), … … 134 123 135 124 // Screen Content 136 $current_screen->add_help_tab( array(125 get_current_screen()->add_help_tab( array( 137 126 'id' => 'screen-content', 138 127 'title' => __( 'Screen Content', 'bbpress' ), … … 148 137 149 138 // Available Actions 150 $current_screen->add_help_tab( array(139 get_current_screen()->add_help_tab( array( 151 140 'id' => 'action-links', 152 141 'title' => __( 'Available Actions', 'bbpress' ), … … 163 152 164 153 // Bulk Actions 165 $current_screen->add_help_tab( array(154 get_current_screen()->add_help_tab( array( 166 155 'id' => 'bulk-actions', 167 156 'title' => __( 'Bulk Actions', 'bbpress' ), … … 172 161 173 162 // Help Sidebar 174 $current_screen->set_help_sidebar(163 get_current_screen()->set_help_sidebar( 175 164 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 176 165 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 187 176 public function new_help() { 188 177 189 $current_screen = get_current_screen();190 $post_type = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';191 192 // Bail if current screen could not be found193 if ( empty( $current_screen ) )194 return;195 196 // Bail if not the topic post type197 if ( $post_type != $this->post_type )198 return;199 200 178 $customize_display = '<p>' . __( 'The title field and the big topic 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>'; 201 179 202 $current_screen->add_help_tab( array(180 get_current_screen()->add_help_tab( array( 203 181 'id' => 'customize-display', 204 182 'title' => __( 'Customizing This Display', 'bbpress' ), … … 206 184 ) ); 207 185 208 $current_screen->add_help_tab( array(186 get_current_screen()->add_help_tab( array( 209 187 'id' => 'title-topic-editor', 210 188 'title' => __( 'Title and Topic Editor', 'bbpress' ), … … 224 202 } 225 203 226 $current_screen->add_help_tab( array(204 get_current_screen()->add_help_tab( array( 227 205 'id' => 'topic-attributes', 228 206 'title' => __( 'Topic Attributes', 'bbpress' ), … … 235 213 ) ); 236 214 237 $current_screen->add_help_tab( array(215 get_current_screen()->add_help_tab( array( 238 216 'id' => 'publish-box', 239 217 'title' => __( 'Publish Box', 'bbpress' ), … … 241 219 ) ); 242 220 243 $current_screen->add_help_tab( array(221 get_current_screen()->add_help_tab( array( 244 222 'id' => 'discussion-settings', 245 223 'title' => __( 'Discussion Settings', 'bbpress' ), … … 249 227 ) ); 250 228 251 $current_screen->set_help_sidebar(229 get_current_screen()->set_help_sidebar( 252 230 '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 253 231 '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . … … 304 282 return $topic_id; 305 283 306 // Bail if post_type is not a topic307 if ( get_post_type( $topic_id ) != $this->post_type )308 return $topic_id;309 310 284 // Bail if current user cannot edit this topic 311 285 if ( !current_user_can( 'edit_topic', $topic_id ) ) … … 364 338 365 339 // Bail if post_type is not a topic 366 if ( ( empty( $_GET['action'] ) || ( 'edit' != $_GET['action'] ) ) || ( get_post_type() != $this->post_type) )340 if ( empty( $_GET['action'] ) || ( 'edit' != $_GET['action'] ) ) 367 341 return; 368 342 … … 410 384 return $post_id; 411 385 412 // Bail if post_type is not a topic or reply413 if ( get_post_type( $post_id ) != $this->post_type )414 return;415 416 386 // Bail if user cannot edit replies 417 387 if ( !current_user_can( 'edit_topic', $post_id ) ) … … 441 411 */ 442 412 function admin_head() { 443 444 if ( get_post_type() == $this->post_type ) : ?> 445 446 <style type="text/css" media="screen"> 447 /*<![CDATA[*/ 448 449 .column-bbp_forum_topic_count, 450 .column-bbp_forum_reply_count, 451 .column-bbp_topic_reply_count, 452 .column-bbp_topic_voice_count { 453 width: 8% !important; 454 } 455 456 .column-author, 457 .column-bbp_reply_author, 458 .column-bbp_topic_author { 459 width: 10% !important; 460 } 461 462 .column-bbp_topic_forum, 463 .column-bbp_reply_forum, 464 .column-bbp_reply_topic { 465 width: 10% !important; 466 } 467 468 .column-bbp_forum_freshness, 469 .column-bbp_topic_freshness { 470 width: 10% !important; 471 } 472 473 .column-bbp_forum_created, 474 .column-bbp_topic_created, 475 .column-bbp_reply_created { 476 width: 15% !important; 477 } 478 479 .status-closed { 480 background-color: #eaeaea; 481 } 482 483 .status-spam { 484 background-color: #faeaea; 485 } 486 487 /*]]>*/ 488 </style> 489 490 <?php endif; 491 413 ?> 414 415 <style type="text/css" media="screen"> 416 /*<![CDATA[*/ 417 418 .column-bbp_forum_topic_count, 419 .column-bbp_forum_reply_count, 420 .column-bbp_topic_reply_count, 421 .column-bbp_topic_voice_count { 422 width: 8% !important; 423 } 424 425 .column-author, 426 .column-bbp_reply_author, 427 .column-bbp_topic_author { 428 width: 10% !important; 429 } 430 431 .column-bbp_topic_forum, 432 .column-bbp_reply_forum, 433 .column-bbp_reply_topic { 434 width: 10% !important; 435 } 436 437 .column-bbp_forum_freshness, 438 .column-bbp_topic_freshness { 439 width: 10% !important; 440 } 441 442 .column-bbp_forum_created, 443 .column-bbp_topic_created, 444 .column-bbp_reply_created { 445 width: 15% !important; 446 } 447 448 .status-closed { 449 background-color: #eaeaea; 450 } 451 452 .status-spam { 453 background-color: #faeaea; 454 } 455 456 /*]]>*/ 457 </style> 458 459 <?php 492 460 } 493 461 … … 812 780 function topics_row_actions( $actions, $topic ) { 813 781 814 if ( $topic->post_type == $this->post_type ) { 815 unset( $actions['inline hide-if-no-js'] ); 816 817 // Show view link if it's not set, the topic is trashed and the user can view trashed topics 818 if ( empty( $actions['view'] ) && ( bbp_get_trash_status_id() == $topic->post_status ) && current_user_can( 'view_trash' ) ) 819 $actions['view'] = '<a href="' . bbp_get_topic_permalink( $topic->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . __( 'View', 'bbpress' ) . '</a>'; 820 821 // Only show the actions if the user is capable of viewing them :) 822 if ( current_user_can( 'moderate', $topic->ID ) ) { 823 824 // Close 825 // Show the 'close' and 'open' link on published and closed posts only 826 if ( in_array( $topic->post_status, array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ) ) { 827 $close_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_close' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'close-topic_' . $topic->ID ) ); 828 if ( bbp_is_topic_open( $topic->ID ) ) 829 $actions['closed'] = '<a href="' . $close_uri . '" title="' . esc_attr__( 'Close this topic', 'bbpress' ) . '">' . _x( 'Close', 'Close a Topic', 'bbpress' ) . '</a>'; 830 else 831 $actions['closed'] = '<a href="' . $close_uri . '" title="' . esc_attr__( 'Open this topic', 'bbpress' ) . '">' . _x( 'Open', 'Open a Topic', 'bbpress' ) . '</a>'; 782 unset( $actions['inline hide-if-no-js'] ); 783 784 // Show view link if it's not set, the topic is trashed and the user can view trashed topics 785 if ( empty( $actions['view'] ) && ( bbp_get_trash_status_id() == $topic->post_status ) && current_user_can( 'view_trash' ) ) 786 $actions['view'] = '<a href="' . bbp_get_topic_permalink( $topic->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'bbpress' ), bbp_get_topic_title( $topic->ID ) ) ) . '" rel="permalink">' . __( 'View', 'bbpress' ) . '</a>'; 787 788 // Only show the actions if the user is capable of viewing them :) 789 if ( current_user_can( 'moderate', $topic->ID ) ) { 790 791 // Close 792 // Show the 'close' and 'open' link on published and closed posts only 793 if ( in_array( $topic->post_status, array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ) ) { 794 $close_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_close' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'close-topic_' . $topic->ID ) ); 795 if ( bbp_is_topic_open( $topic->ID ) ) 796 $actions['closed'] = '<a href="' . $close_uri . '" title="' . esc_attr__( 'Close this topic', 'bbpress' ) . '">' . _x( 'Close', 'Close a Topic', 'bbpress' ) . '</a>'; 797 else 798 $actions['closed'] = '<a href="' . $close_uri . '" title="' . esc_attr__( 'Open this topic', 'bbpress' ) . '">' . _x( 'Open', 'Open a Topic', 'bbpress' ) . '</a>'; 799 } 800 801 // Dont show sticky if topic links is spam or trash 802 if ( !bbp_is_topic_spam( $topic->ID ) && !bbp_is_topic_trash( $topic->ID ) ) { 803 804 // Sticky 805 $stick_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'stick-topic_' . $topic->ID ) ); 806 if ( bbp_is_topic_sticky( $topic->ID ) ) { 807 $actions['stick'] = '<a href="' . $stick_uri . '" title="' . esc_attr__( 'Unstick this topic', 'bbpress' ) . '">' . __( 'Unstick', 'bbpress' ) . '</a>'; 808 } else { 809 $super_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick', 'super' => '1' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'stick-topic_' . $topic->ID ) ); 810 $actions['stick'] = '<a href="' . $stick_uri . '" title="' . esc_attr__( 'Stick this topic to its forum', 'bbpress' ) . '">' . __( 'Stick', 'bbpress' ) . '</a> (<a href="' . $super_uri . '" title="' . esc_attr__( 'Stick this topic to front', 'bbpress' ) . '">' . __( 'to front', 'bbpress' ) . '</a>)'; 832 811 } 833 834 // Dont show sticky if topic links is spam or trash 835 if ( !bbp_is_topic_spam( $topic->ID ) && !bbp_is_topic_trash( $topic->ID ) ) { 836 837 // Sticky 838 $stick_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'stick-topic_' . $topic->ID ) ); 839 if ( bbp_is_topic_sticky( $topic->ID ) ) { 840 $actions['stick'] = '<a href="' . $stick_uri . '" title="' . esc_attr__( 'Unstick this topic', 'bbpress' ) . '">' . __( 'Unstick', 'bbpress' ) . '</a>'; 841 } else { 842 $super_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_stick', 'super' => '1' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'stick-topic_' . $topic->ID ) ); 843 $actions['stick'] = '<a href="' . $stick_uri . '" title="' . esc_attr__( 'Stick this topic to its forum', 'bbpress' ) . '">' . __( 'Stick', 'bbpress' ) . '</a> (<a href="' . $super_uri . '" title="' . esc_attr__( 'Stick this topic to front', 'bbpress' ) . '">' . __( 'to front', 'bbpress' ) . '</a>)'; 844 } 845 } 846 847 // Spam 848 $spam_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_spam' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'spam-topic_' . $topic->ID ) ); 849 if ( bbp_is_topic_spam( $topic->ID ) ) 850 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark the topic as not spam', 'bbpress' ) . '">' . __( 'Not spam', 'bbpress' ) . '</a>'; 851 else 852 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark this topic as spam', 'bbpress' ) . '">' . __( 'Spam', 'bbpress' ) . '</a>'; 853 854 } 855 856 // Do not show trash links for spam topics, or spam links for trashed topics 857 if ( current_user_can( 'delete_topic', $topic->ID ) ) { 858 if ( bbp_get_trash_status_id() == $topic->post_status ) { 859 $post_type_object = get_post_type_object( bbp_get_topic_post_type() ); 860 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . "' href='" . wp_nonce_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $topic->ID ) ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>"; 861 } elseif ( EMPTY_TRASH_DAYS ) { 862 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $topic->ID ) ) . "'>" . __( 'Trash', 'bbpress' ) . "</a>"; 863 } 864 865 if ( bbp_get_trash_status_id() == $topic->post_status || !EMPTY_TRASH_DAYS ) { 866 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $topic->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>"; 867 } elseif ( bbp_get_spam_status_id() == $topic->post_status ) { 868 unset( $actions['trash'] ); 869 } 812 } 813 814 // Spam 815 $spam_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_spam' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'spam-topic_' . $topic->ID ) ); 816 if ( bbp_is_topic_spam( $topic->ID ) ) 817 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark the topic as not spam', 'bbpress' ) . '">' . __( 'Not spam', 'bbpress' ) . '</a>'; 818 else 819 $actions['spam'] = '<a href="' . $spam_uri . '" title="' . esc_attr__( 'Mark this topic as spam', 'bbpress' ) . '">' . __( 'Spam', 'bbpress' ) . '</a>'; 820 821 } 822 823 // Do not show trash links for spam topics, or spam links for trashed topics 824 if ( current_user_can( 'delete_topic', $topic->ID ) ) { 825 if ( bbp_get_trash_status_id() == $topic->post_status ) { 826 $post_type_object = get_post_type_object( bbp_get_topic_post_type() ); 827 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . "' href='" . wp_nonce_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $topic->ID ) ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>"; 828 } elseif ( EMPTY_TRASH_DAYS ) { 829 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $topic->ID ) ) . "'>" . __( 'Trash', 'bbpress' ) . "</a>"; 830 } 831 832 if ( bbp_get_trash_status_id() == $topic->post_status || !EMPTY_TRASH_DAYS ) { 833 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $topic->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>"; 834 } elseif ( bbp_get_spam_status_id() == $topic->post_status ) { 835 unset( $actions['trash'] ); 870 836 } 871 837 } … … 885 851 */ 886 852 function filter_dropdown() { 887 888 // Bail if not viewing the topics list889 if (890 // post_type exists in _GET891 empty( $_GET['post_type'] ) ||892 893 // post_type is not topic type894 ( $_GET['post_type'] != $this->post_type )895 )896 return;897 853 898 854 // Add Empty Spam button … … 925 881 */ 926 882 function filter_post_rows( $query_vars ) { 927 global $pagenow;928 929 // Avoid poisoning other requests930 if (931 // Only look in admin932 !is_admin() ||933 934 // Make sure the current page is for post rows935 ( 'edit.php' != $pagenow ) ||936 937 // Make sure we're looking for a post_type938 empty( $_GET['post_type'] ) ||939 940 // Make sure we're looking at bbPress topics941 ( $_GET['post_type'] != $this->post_type )942 )943 944 // We're in no shape to filter anything, so return945 return $query_vars;946 883 947 884 // Add post_parent query_var if one is present … … 961 898 * 962 899 * @global int $post_ID 963 * @uses get_post_type()964 900 * @uses bbp_get_topic_permalink() 965 901 * @uses wp_post_revision_title() … … 973 909 function updated_messages( $messages ) { 974 910 global $post_ID; 975 976 if ( get_post_type( $post_ID ) != $this->post_type )977 return $messages;978 911 979 912 // URL for the current topic … … 1033 966 * Setup bbPress Topics Admin 1034 967 * 968 * This is currently here to make hooking and unhooking of the admin UI easy. 969 * It could use dependency injection in the future, but for now this is easier. 970 * 1035 971 * @since bbPress (r2596) 1036 972 * … … 1038 974 */ 1039 975 function bbp_admin_topics() { 976 global $typenow; 977 978 if ( bbp_get_topic_post_type() != $typenow ) 979 return; 980 1040 981 bbpress()->admin->topics = new BBP_Topics_Admin(); 1041 982 } -
branches/plugin/bbp-admin/bbp-users.php
r3966 r4053 100 100 } 101 101 endif; // class exists 102 103 /**104 * Setup bbPress Users Admin105 *106 * @since bbPress (r2596)107 *108 * @uses BBP_Replies_Admin109 */110 function bbp_users_admin() {111 bbpress()->admin->users = new BBP_Users_Admin();112 }
Note: See TracChangeset
for help on using the changeset viewer.