Changeset 3811 for branches/plugin/bbp-admin/bbp-tools.php
- Timestamp:
- 03/19/2012 06:12:21 PM (14 years ago)
- File:
-
- 1 edited
-
branches/plugin/bbp-admin/bbp-tools.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-tools.php
r3790 r3811 23 23 * @uses wp_nonce_field() To add a hidden nonce field 24 24 */ 25 function bbp_admin_tools() { 26 27 $recount_list = bbp_recount_list(); 28 29 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) { 30 check_admin_referer( 'do-counts' ); 31 32 // Stores messages 33 $messages = array(); 34 35 wp_cache_flush(); 36 37 foreach ( (array) $recount_list as $item ) 38 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 == $_POST[$item[0]] && is_callable( $item[2] ) ) 39 $messages[] = call_user_func( $item[2] ); 40 41 42 if ( count( $messages ) ) { 43 foreach ( $messages as $message ) { 44 bbp_tools_feedback( $message[1] ); 45 } 46 } 47 } ?> 25 function bbp_admin_tools_screen() { 26 27 $recount_list = bbp_recount_list(); ?> 48 28 49 29 <div class="wrap"> … … 52 32 53 33 <h2><?php _e( 'bbPress Recount', 'bbpress' ) ?></h2> 54 55 <?php do_action( 'admin_notices' ); ?>56 34 57 35 <p><?php _e( 'bbPress keeps a running count of things like replies to each topic and topics in each forum. In rare occasions these counts can fall out of sync. Using this form you can have bbPress manually recount these items.', 'bbpress' ); ?></p> … … 88 66 <fieldset class="submit"> 89 67 <input class="button-primary" type="submit" name="submit" value="<?php _e( 'Recount Items', 'bbpress' ); ?>" /> 90 <?php wp_nonce_field( ' do-counts' ); ?>68 <?php wp_nonce_field( 'bbpress-do-counts' ); ?> 91 69 </fieldset> 92 70 </form> … … 94 72 95 73 <?php 74 } 75 76 /** 77 * Handle the processing and feedback of the admin tools page 78 * 79 * @since bbPress (r2613) 80 * 81 * @uses bbp_recount_list() To get the recount list 82 * @uses check_admin_referer() To verify the nonce and the referer 83 * @uses wp_cache_flush() To flush the cache 84 * @uses do_action() Calls 'admin_notices' to display the notices 85 */ 86 function bbp_admin_tools_handler() { 87 88 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) { 89 check_admin_referer( 'bbpress-do-counts' ); 90 91 // Stores messages 92 $messages = array(); 93 $recount_list = bbp_recount_list(); 94 95 wp_cache_flush(); 96 97 foreach ( (array) $recount_list as $item ) { 98 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 == $_POST[$item[0]] && is_callable( $item[2] ) ) { 99 $messages[] = call_user_func( $item[2] ); 100 } 101 } 102 103 if ( count( $messages ) ) { 104 foreach ( $messages as $message ) { 105 bbp_tools_feedback( $message[1] ); 106 } 107 } 108 } 96 109 } 97 110
Note: See TracChangeset
for help on using the changeset viewer.