Skip to:
Content

BuddyPress.org


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

Introduce bp_core_mark_all_notifications_by_type() and replace bp_core_delete_all_notifications_by_type() usages. Ensures notifications are toggled as acknowledged rather than deleted. See #5148.

File:
1 edited

Legend:

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

    r7522 r7529  
    147147 * Delete all notifications for by type
    148148 *
     149 * @since BuddyPress (1.0)
     150 * @param int $user_id
     151 * @param string $component_name
     152 * @param string $component_action
     153 * @return boolean True on success, false on fail
     154 */
     155function bp_core_delete_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false ) {
     156
     157    // Bail if notifications is not active
     158    if ( ! bp_is_active( 'notifications' ) ) {
     159        return false;
     160    }
     161
     162    bp_notifications_delete_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id );
     163}
     164
     165/**
     166 * Mark all notifications read/unread for by type
     167 *
    149168 * Used when clearing out notifications for an entire component
    150169 *
    151  * @since BuddyPress (1.0)
    152  * @param int $user_id
    153  * @param string $component_name
    154  * @param string $component_action
    155  * @return boolean True on success, false on fail
    156  */
    157 function bp_core_delete_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false ) {
    158 
    159     // Bail if notifications is not active
    160     if ( ! bp_is_active( 'notifications' ) ) {
    161         return false;
    162     }
    163 
    164     bp_notifications_delete_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id );
     170 * @since BuddyPress (1.9)
     171 * @param int $user_id
     172 * @param string $component_name
     173 * @param string $component_action
     174 * @return boolean True on success, false on fail
     175 */
     176function bp_core_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false ) {
     177
     178    // Bail if notifications is not active
     179    if ( ! bp_is_active( 'notifications' ) ) {
     180        return false;
     181    }
     182
     183    bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id, $is_new );
    165184}
    166185
Note: See TracChangeset for help on using the changeset viewer.