bp_admin_tools_feedback( string $message, string|bool $class = false )

Assemble admin notices relating success/failure of repair processes.

Description

Parameters

$message

(Required) Feedback message.

$class

(Optional) Unused.

Default value: false

Return

(false|Closure)

Source

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

816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
function bp_admin_tools_feedback( $message, $class = false ) {
    if ( is_string( $message ) ) {
        $message = '<p>' . $message . '</p>';
        $class   = $class ? $class : 'updated';
    } elseif ( is_wp_error( $message ) ) {
        $errors = $message->get_error_messages();
 
        switch ( count( $errors ) ) {
            case 0:
                return false;
 
            case 1:
                $message = '<p>' . $errors[0] . '</p>';
                break;
 
            default:
                $message = '<ul>' . "\n\t" . '<li>' . implode( '</li>' . "\n\t" . '<li>', $errors ) . '</li>' . "\n" . '</ul>';
                break;
        }
 
        $class = $class ? $class : 'error';
    } else {
        return false;
    }
 
    $message = '<div id="message" class="' . esc_attr( $class ) . '">' . $message . '</div>';
    $message = str_replace( "'", "\'", $message );
    $lambda  = function () use ( $message ) {
        echo $message;
    };
 
    add_action( bp_core_do_network_admin() ? 'network_admin_notices' : 'admin_notices', $lambda );
 
    return $lambda;
}

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.