bp_admin_repair_tools_wrapper_function()

Wrapper function to handle Repair Community all the actions.

Description

Source

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

1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
function bp_admin_repair_tools_wrapper_function() {
    $response = array(
            'feedback' => sprintf(
                    '<div class="bp-feedback error bp-ajax-message"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>',
                    esc_html__( 'There was a problem performing this action. Please try again.', 'buddyboss' )
            ),
    );
 
    $type = filter_input( INPUT_POST, 'type', FILTER_SANITIZE_STRING );
 
    if ( empty( $type ) ) {
        wp_send_json_error( $response );
    }
 
    // Bail if not a POST action.
    if ( ! bp_is_post_request() ) {
        wp_send_json_error( $response );
    }
 
    if ( empty( $_POST['nonce'] ) ) {
        wp_send_json_error( $response );
    }
 
    // Use default nonce
    $nonce = $_POST['nonce'];
    $check = 'bp-do-counts';
 
    // Nonce check!
    if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, $check ) ) {
        wp_send_json_error( $response );
    }
 
    $repair_list = bp_admin_repair_list();
 
    $status = array();
    foreach ( $repair_list as $repair_item ) {
        if ( $repair_item[0] === $type && is_callable( $repair_item[2] ) ) {
            $status = call_user_func( $repair_item[2] );
            break;
        }
    }
 
//  if ( 'bp-user-friends' === $type ) {
//      $status = bp_admin_repair_friend_count();
//  } elseif ( 'bp-group-count' === $type ) {
//      $status = bp_admin_repair_group_count();
//  } elseif ( 'bp-total-member-count' === $type ) {
//      $status = bp_admin_repair_count_members();
//  } elseif ( 'bp-last-activity' === $type ) {
//      $status = bp_admin_repair_last_activity();
//  } elseif ( 'bp-xprofile-fields' === $type ) {
//      $status = repair_default_profiles_fields();
//  } elseif ( 'bp-xprofile-wordpress-resync' === $type ) {
//      $status = resync_xprofile_wordpress_fields();
//  } elseif ( 'bp-wordpress-xprofile-resync' === $type ) {
//      $status = resync_wordpress_xprofile_fields();
//  } elseif ( 'bp-wordpress-update-display-name' === $type ) {
//      $status = xprofile_update_display_names();
//  } elseif ( 'bp-blog-records' === $type ) {
//      $status = bp_admin_repair_blog_records();
//  } elseif ( 'bp-reinstall-emails' === $type ) {
//      $status = bp_admin_reinstall_emails();
//  } elseif ( 'bp-assign-member-type' === $type ) {
//      $status = bp_admin_assign_member_type();
//  } elseif ( 'bp-sync-activity-favourite' === $type ) {
//      $status = bp_admin_update_activity_favourite();
//  } elseif ( 'bp-invitations-table' === $type ) {
//      $status = bp_admin_invitations_table();
//  } elseif ( 'bp-media-forum-privacy-repair' === $type ) {
//      $status = bp_media_forum_privacy_repair();
//  }
    wp_send_json_success( $status );
}

Changelog

Changelog
Version Description
BuddyBoss 1.1.8 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.