Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2009 07:54:21 PM (16 years ago)
Author:
apeatling
Message:

Merging 1.1 branch changes and syncing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-notifications.php

    r1905 r2077  
    33function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = false, $date_notified = false ) {
    44    global $bp;
    5    
     5
    66    if ( !$date_notified )
    77        $date_notified = time();
    8        
     8
    99    $notification = new BP_Core_Notification;
    1010    $notification->item_id = $item_id;
     
    1717    if ( $secondary_item_id )
    1818        $notification->secondary_item_id = $secondary_item_id;
    19    
     19
    2020    if ( !$notification->save() )
    2121        return false;
    22    
     22
    2323    return true;
    2424}
     
    2727    if ( !bp_core_check_notification_access( $bp->loggedin_user->id, $id ) )
    2828        return false;
    29    
     29
    3030    return BP_Core_Notification::delete( $id );
    3131}
    3232
    3333function bp_core_get_notification( $id ) {
    34     return new BP_Core_Notification( $id ); 
     34    return new BP_Core_Notification( $id );
    3535}
    3636
    3737function bp_core_get_notifications_for_user( $user_id ) {
    3838    global $bp;
    39    
     39
    4040    $notifications = BP_Core_Notification::get_all_for_user( $user_id );
    41    
     41
    4242    /* Group notifications by component and component_action and provide totals */
    4343    for ( $i = 0; $i < count($notifications); $i++ ) {
    4444        $notification = $notifications[$i];
    45        
     45
    4646        $grouped_notifications[$notification->component_name][$notification->component_action][] = $notification;
    4747    }
    48    
     48
    4949    if ( !$grouped_notifications )
    5050        return false;
    51    
     51
    5252    /* Calculated a renderable outcome for each notification type */
    5353    foreach ( $grouped_notifications as $component_name => $action_arrays ) {
    5454        if ( !$action_arrays )
    5555            continue;
    56        
     56
    5757        foreach ( $action_arrays as $component_action_name => $component_action_items ) {
    5858            $action_item_count = count($component_action_items);
    59            
     59
    6060            if ( $action_item_count < 1 )
    6161                continue;
     
    6565            }
    6666        }
    67     }   
    68    
     67    }
     68
    6969    return $renderable;
    7070}
     
    8989    if ( !BP_Core_Notification::check_access( $user_id, $notification_id ) )
    9090        return false;
    91    
     91
    9292    return true;
    9393}
Note: See TracChangeset for help on using the changeset viewer.