bp_core_print_admin_notices

Print admin messages to admin_notices or network_admin_notices.

Description

bp_core_print_admin_notices(); 

BuddyPress combines all its messages into a single notice, to avoid a preponderance of yellow boxes.


Usage

  1. if ( !function_exists( 'bp_core_print_admin_notices' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_print_admin_notices(); 
  7.  

Defined (1)

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

/bp-core/admin/bp-core-admin-functions.php  
  1. function bp_core_print_admin_notices() { 
  2.  
  3. // Only the super admin should see messages. 
  4. if ( ! bp_current_user_can( 'bp_moderate' ) ) { 
  5. return; 
  6.  
  7. // On multisite installs, don't show on a non-root blog, unless 
  8. // 'do_network_admin' is overridden. 
  9. if ( is_multisite() && bp_core_do_network_admin() && ! bp_is_root_blog() ) { 
  10. return; 
  11.  
  12. $notice_types = array(); 
  13. foreach (buddypress)->admin->notices as $notice ) { 
  14. $notice_types[] = $notice['type']; 
  15. $notice_types = array_unique( $notice_types ); 
  16.  
  17. foreach ( $notice_types as $type ) { 
  18. $notices = wp_list_filter(buddypress)->admin->notices, array( 'type' => $type ) ); 
  19. printf( '<div id="message" class="fade %s">', sanitize_html_class( $type ) ); 
  20.  
  21. foreach ( $notices as $notice ) { 
  22. printf( '<p>%s</p>', $notice['message'] ); 
  23.  
  24. printf( '</div>' );