Skip to:
Content

BuddyPress.org


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

Introduce bp_core_mark_notifications_by_type() and bp_core_mark_notifications_by_item_id() and replace bp_core_delete_notifications_by_type() and bp_core_delete_notifications_by_item_id() 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

    r7529 r7530  
    100100}
    101101
     102/** Delete ********************************************************************/
     103
    102104/**
    103105 * Delete notifications for a user by type
     
    163165}
    164166
     167/** Mark **********************************************************************/
     168
     169/**
     170 * Delete notifications for a user by type
     171 *
     172 * Used when clearing out notifications for a specific component when the user
     173 * has visited that component.
     174 *
     175 * @since BuddyPress (1.0)
     176 * @param int $user_id
     177 * @param string $component_name
     178 * @param string $component_action
     179 * @param int $is_new
     180 * @return boolean True on success, false on fail
     181 */
     182function bp_core_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new = false ) {
     183
     184    // Bail if notifications is not active
     185    if ( ! bp_is_active( 'notifications' ) ) {
     186        return false;
     187    }
     188
     189    return bp_notifications_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new );
     190}
     191
     192/**
     193 * Delete notifications for an item ID
     194 *
     195 * Used when clearing out notifications for a specific component when the user
     196 * has visited that component.
     197 *
     198 * @since BuddyPress (1.0)
     199 * @param int $user_id
     200 * @param string $component_name
     201 * @param string $component_action
     202 * @param int $is_new
     203 * @return boolean True on success, false on fail
     204 */
     205function bp_core_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false, $is_new = false ) {
     206
     207    // Bail if notifications is not active
     208    if ( ! bp_is_active( 'notifications' ) ) {
     209        return false;
     210    }
     211
     212    return bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id, $is_new );
     213}
     214
    165215/**
    166216 * Mark all notifications read/unread for by type
Note: See TracChangeset for help on using the changeset viewer.