bp_admin_repair_handler()

Handle the processing and feedback of the admin tools page.

Description

Source

File: bp-core/admin/bp-core-admin-tools.php

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
function bp_admin_repair_handler() {
    if ( ! bp_is_post_request() || empty( $_POST['bp-tools-submit'] ) ) {
        return;
    }
 
    check_admin_referer( 'bp-do-counts' );
 
    // Bail if user cannot moderate.
    $capability = bp_core_do_network_admin() ? 'manage_network_options' : 'manage_options';
    if ( ! bp_current_user_can( $capability ) ) {
        return;
    }
 
    wp_cache_flush();
    $messages = array();
 
    foreach ( (array) bp_admin_repair_list() as $item ) {
        if ( isset( $item[2] ) && isset( $_POST[ $item[0] ] ) && 1 === absint( $_POST[ $item[0] ] ) && is_callable( $item[2] ) ) {
            $messages[] = call_user_func( $item[2] );
        }
    }
 
    if ( count( $messages ) ) {
        foreach ( $messages as $message ) {
            bp_admin_tools_feedback( $message[1] );
        }
    }
}

Changelog

Changelog
Version Description
BuddyPress 2.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.