bb_admin_notice

The BuddyPress bb admin notice function.

Description

bb_admin_notice( $message, (bool) $class = false ); 

Parameters (2)

0. $message
The message.
1. $class — Optional. (bool) => false
The class.

Usage

  1. if ( !function_exists( 'bb_admin_notice' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php'; 
  3.  
  4. // The message. 
  5. $message = null; 
  6.  
  7. // The class. 
  8. $class = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_admin_notice($message, $class); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php  
  1. function bb_admin_notice( $message, $class = false ) 
  2. if ( is_string( $message ) ) { 
  3. $message = '<p>' . $message . '</p>'; 
  4. $class = $class ? $class : 'updated'; 
  5. } elseif ( is_wp_error( $message ) ) { 
  6. $errors = $message->get_error_messages(); 
  7. switch ( count( $errors ) ) { 
  8. case 0: 
  9. return false; 
  10. break; 
  11. case 1: 
  12. $message = '<p>' . $errors[0] . '</p>'; 
  13. break; 
  14. default: 
  15. $message = '<ul>' . "\n\t" . '<li>' . join( '</li>' . "\n\t" . '<li>', $errors ) . '</li>' . "\n" . '</ul>'; 
  16. break; 
  17. $class = $class ? $class : error; 
  18. } else { 
  19. return false; 
  20.  
  21. $message = '<div id="message" class="' . esc_attr( $class ) . '">' . $message . '</div>'; 
  22. $message = str_replace( "'", "\'", $message ); 
  23. $lambda = create_function( '', "echo '$message';" ); 
  24. return $lambda;