bbp_admin_tools_feedback( string|WP_Error $message, string $class = false )
Assemble the admin notices
Description
Parameters
- $message
-
(Required) A message to be displayed or WP_Error
- $class
-
(Optional) A class to be added to the message div
Default value: false
Return
(string) The message HTML
Source
File: bp-forums/admin/tools.php
function bbp_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; break; 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 = create_function( '', "echo '$message';" ); add_action( 'admin_notices', $lambda ); return $lambda; }
Changelog
Version | Description |
---|---|
bbPress (r2613) | 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.