Changeset 9171
- Timestamp:
- 11/25/2014 08:45:16 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-functions.php
r9113 r9171 120 120 * boxes. 121 121 * 122 * @package BuddyPress Core123 122 * @since BuddyPress (1.5) 124 123 * … … 139 138 } 140 139 141 // Get the admin notices 142 $admin_notices = buddypress()->admin->notices; 143 144 // Show the messages 145 if ( !empty( $admin_notices ) ) : ?> 146 147 <div id="message" class="updated fade"> 148 149 <?php foreach ( $admin_notices as $notice ) : ?> 150 151 <p><?php echo $notice; ?></p> 152 153 <?php endforeach; ?> 154 155 </div> 156 157 <?php endif; 140 $notice_types = array(); 141 foreach ( buddypress()->admin->notices as $notice ) { 142 $notice_types[] = $notice['type']; 143 } 144 $notice_types = array_unique( $notice_types ); 145 146 foreach ( $notice_types as $type ) { 147 $notices = wp_list_filter( buddypress()->admin->notices, array( 'type' => $type ) ); 148 printf( '<div id="message" class="fade %s">', sanitize_html_class( $type ) ); 149 150 foreach ( $notices as $notice ) { 151 printf( '<p>%s</p>', $notice['message'] ); 152 } 153 154 printf( '</div>' ); 155 } 158 156 } 159 157 add_action( 'admin_notices', 'bp_core_print_admin_notices' ); … … 167 165 * loaded in time. 168 166 * 169 * @package BuddyPress Core170 167 * @since BuddyPress (1.5) 171 168 * 172 * @param string $notice The notice you are adding to the queue 173 */ 174 function bp_core_add_admin_notice( $notice = '' ) { 169 * @param string $notice The notice you are adding to the queue. 170 * @param string $type The notice type; optional. Usually either "updated" or "error". 171 */ 172 function bp_core_add_admin_notice( $notice = '', $type = 'updated' ) { 175 173 176 174 // Do not add if the notice is empty … … 185 183 186 184 // Add the notice 187 buddypress()->admin->notices[] = $notice; 185 buddypress()->admin->notices[] = array( 186 'message' => $notice, 187 'type' => $type, 188 ); 188 189 } 189 190
Note: See TracChangeset
for help on using the changeset viewer.