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
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
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.