Changeset 7578
- Timestamp:
- 11/16/2013 01:08:49 AM (11 years ago)
- Location:
- trunk/bp-notifications
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-notifications/bp-notifications-functions.php
r7543 r7578 148 148 } 149 149 150 // Skip inactive components151 if ( ! bp_is_active( $component_name ) ) {152 continue;153 }154 155 150 // Loop through each actionable item and try to map it to a component 156 151 foreach ( (array) $action_arrays as $component_action_name => $component_action_items ) { … … 168 163 169 164 // Function should return an object 170 if ( 'object' == $format ) {165 if ( 'object' === $format ) { 171 166 172 167 // Retrieve the content of the notification using the callback … … 205 200 } elseif ( isset( $bp->{$component_name}->format_notification_function ) && function_exists( $bp->{$component_name}->format_notification_function ) ) { 206 201 $renderable[] = call_user_func( $bp->{$component_name}->format_notification_function, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count ); 202 203 // Allow non BuddyPress components to hook in 204 } else { 205 206 // The array to reference with apply_filters_ref_array() 207 $ref_array = array( 208 $component_action_name, 209 $component_action_items[0]->item_id, 210 $component_action_items[0]->secondary_item_id, 211 $action_item_count, 212 $format 213 ); 214 215 // Function should return an object 216 if ( 'object' === $format ) { 217 218 // Retrieve the content of the notification using the callback 219 $content = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array ); 220 221 // Create the object to be returned 222 $notification_object = new stdClass; 223 224 // Minimal backpat with non-compatible notification 225 // callback functions 226 if ( is_string( $content ) ) { 227 $notification_object->content = $content; 228 $notification_object->href = bp_loggedin_user_domain(); 229 } else { 230 $notification_object->content = $content['text']; 231 $notification_object->href = $content['link']; 232 } 233 234 $notification_object->id = $component_action_items[0]->id; 235 $renderable[] = $notification_object; 236 237 // Return an array of content strings 238 } else { 239 $renderable[] = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array ); 240 } 207 241 } 208 242 } -
trunk/bp-notifications/bp-notifications-template.php
r7559 r7578 691 691 $notification = $bp->notifications->query_loop->notification; 692 692 693 // Skip inactive components694 if ( ! bp_is_active( $notification->component_name ) ) {695 return;696 }697 698 693 // Callback function exists 699 694 if ( isset( $bp->{ $notification->component_name }->notification_callback ) && is_callable( $bp->{ $notification->component_name }->notification_callback ) ) { … … 703 698 } elseif ( isset( $bp->{ $notification->component_name }->format_notification_function ) && function_exists( $bp->{ $notification->component_name }->format_notification_function ) ) { 704 699 $description = call_user_func( $bp->{ $notification->component_name }->format_notification_function, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 ); 700 701 // Allow non BuddyPress components to hook in 702 } else { 703 $description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 ) ); 705 704 } 706 705
Note: See TracChangeset
for help on using the changeset viewer.