Skip to:
Content

BuddyPress.org

Changeset 7533


Ignore:
Timestamp:
11/08/2013 05:45:34 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Make sure notifications always have date. See #5148.

File:
1 edited

Legend:

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

    r7532 r7533  
    2424 * @param string $secondary_item_id
    2525 * @param string $date_notified
    26  * @param string $is_new
    27  * @return boolean True on success, false on fail
    28  */
    29 function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = 0, $date_notified = false, $is_new = true ) {
    30 
    31     // Bail if notifications is not active
    32     if ( ! bp_is_active( 'notifications' ) ) {
    33         return false;
    34     }
    35 
    36     $args = array(
     26 * @param int $is_new
     27 * @return boolean True on success, false on fail
     28 */
     29function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = 0, $date_notified = false, $is_new = 1 ) {
     30
     31    // Bail if notifications is not active
     32    if ( ! bp_is_active( 'notifications' ) ) {
     33        return false;
     34    }
     35
     36    // Notifications must always have a time
     37    if ( false === $date_notified ) {
     38        $date_notified = bp_core_current_time();
     39    }
     40
     41    // Add the notification
     42    return bp_notifications_add_notification( array(
    3743        'item_id'           => $item_id,
    3844        'user_id'           => $user_id,
     
    4248        'date_notified'     => $date_notified,
    4349        'is_new'            => $is_new
    44     );
    45 
    46     return bp_notifications_add_notification( $args );
     50    ) );
    4751}
    4852
Note: See TracChangeset for help on using the changeset viewer.