/** * Add a notification for a specific user, from a specific component * * @since BuddyPress (1.0) * @param string $item_id * @param int $user_id * @param string $component_name * @param string $component_action * @param string $secondary_item_id * @param string $date_notified * @return boolean True on success, false on fail */ function bp_core_add_notification($item_id, $user_id, $component_name, $component_action, $secondary_item_id = 0, $date_notified = false) { if (empty($date_notified)) { $date_notified = bp_core_current_time(); } $notification = new BP_Core_Notification(); $notification->item_id = $item_id; $notification->user_id = $user_id; $notification->component_name = $component_name; $notification->component_action = $component_action; $notification->date_notified = $date_notified; $notification->is_new = 1; if (!empty($secondary_item_id)) { $notification->secondary_item_id = $secondary_item_id; } if ($notification->save()) { return true; } return false; }
function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = false, $date_notified = false ) { global $bp; if ( !$date_notified ) $date_notified = bp_core_current_time(); $notification = new BP_Core_Notification; $notification->item_id = $item_id; $notification->user_id = $user_id; $notification->component_name = $component_name; $notification->component_action = $component_action; $notification->date_notified = $date_notified; $notification->is_new = 1; if ( $secondary_item_id ) $notification->secondary_item_id = $secondary_item_id; if ( !$notification->save() ) return false; return true; }