Changeset 5017 for trunk/includes/admin/tools.php
- Timestamp:
- 07/10/2013 07:17:14 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/tools.php
r5002 r5017 91 91 92 92 foreach ( (array) bbp_admin_repair_list() as $item ) { 93 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 === $_POST[$item[0]]&& is_callable( $item[2] ) ) {93 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 === absint( $_POST[$item[0]] ) && is_callable( $item[2] ) ) { 94 94 $messages[] = call_user_func( $item[2] ); 95 95 } … … 938 938 */ 939 939 function bbp_admin_repair_forum_visibility() { 940 941 940 $statement = __( 'Recalculating forum visibility … %s', 'bbpress' ); 942 $result = __( 'Failed!', 'bbpress' );943 944 // First, delete everything.945 delete_option( '_bbp_private_forums' );946 delete_option( '_bbp_hidden_forums' );947 948 // Next, get all the private and hidden forums949 $private_forums = new WP_Query( array(950 'suppress_filters' => true,951 'nopaging' => true,952 'post_type' => bbp_get_forum_post_type(),953 'post_status' => bbp_get_private_status_id(),954 'fields' => 'ids'955 ) );956 $hidden_forums = new WP_Query( array(957 'suppress_filters' => true,958 'nopaging' => true,959 'post_type' => bbp_get_forum_post_type(),960 'post_status' => bbp_get_hidden_status_id(),961 'fields' => 'ids'962 ) );963 941 964 942 // Bail if queries returned errors 965 if ( is_wp_error( $private_forums ) || is_wp_error( $hidden_forums ) ) 966 return array( 2, sprintf( $statement, $result ) ); 967 968 update_option( '_bbp_private_forums', $private_forums->posts ); // Private forums 969 update_option( '_bbp_hidden_forums', $hidden_forums->posts ); // Hidden forums 970 971 // Reset the $post global 972 wp_reset_postdata(); 943 if ( ! bbp_repair_forum_visibility() ) { 944 return array( 2, sprintf( $statement, __( 'Failed!', 'bbpress' ) ) ); 973 945 974 946 // Complete results 975 return array( 0, sprintf( $statement, __( 'Complete!', 'bbpress' ) ) ); 947 } else { 948 return array( 0, sprintf( $statement, __( 'Complete!', 'bbpress' ) ) ); 949 } 976 950 } 977 951
Note: See TracChangeset
for help on using the changeset viewer.