Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/08/2013 07:53:56 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Use the correct function and update methods for marking user notifications as read. See #5148.

File:
1 edited

Legend:

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

    r7536 r7537  
    307307 */
    308308function bp_notifications_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new = false ) {
    309     return BP_Notifications_Notification::delete( array(
    310         'user_id'          => $user_id,
    311         'component_name'   => $component_name,
    312         'component_action' => $component_action,
    313         'is_new'           => $is_new,
    314     ) );
     309    return BP_Notifications_Notification::update(
     310        array(
     311            'is_new' => $is_new
     312        ),
     313        array(
     314            'user_id'          => $user_id,
     315            'component_name'   => $component_name,
     316            'component_action' => $component_action
     317        )
     318    );
    315319}
    316320
     
    332336 */
    333337function bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false, $is_new = false ) {
    334     return BP_Notifications_Notification::delete( array(
    335         'user_id'           => $user_id,
    336         'item_id'           => $item_id,
    337         'secondary_item_id' => $secondary_item_id,
    338         'component_name'    => $component_name,
    339         'component_action'  => $component_action,
    340         'is_new'            => $is_new,
    341     ) );
     338    return BP_Notifications_Notification::update(
     339        array(
     340            'is_new' => $is_new
     341        ),
     342        array(
     343            'user_id'           => $user_id,
     344            'item_id'           => $item_id,
     345            'secondary_item_id' => $secondary_item_id,
     346            'component_name'    => $component_name,
     347            'component_action'  => $component_action
     348        )
     349    );
    342350}
    343351
     
    358366 */
    359367function bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false ) {
    360     return BP_Notifications_Notification::delete( array(
    361         'item_id'           => $item_id,
    362         'secondary_item_id' => $secondary_item_id,
    363         'component_name'    => $component_name,
    364         'component_action'  => $component_action,
    365         'is_new'            => $is_new,
    366     ) );
     368    return BP_Notifications_Notification::update(
     369        array(
     370            'is_new' => $is_new
     371        ),
     372        array(
     373            'item_id'           => $item_id,
     374            'secondary_item_id' => $secondary_item_id,
     375            'component_name'    => $component_name,
     376            'component_action'  => $component_action
     377        )
     378    );
    367379}
    368380
     
    386398 */
    387399function bp_notifications_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new = false ) {
    388     return BP_Notifications_Notification::delete( array(
    389         'item_id'          => $user_id,
    390         'component_name'   => $component_name,
    391         'component_action' => $component_action,
    392         'is_new'           => $is_new,
    393     ) );
     400    return BP_Notifications_Notification::_update(
     401        array(
     402            'is_new' => $is_new
     403        ),
     404        array(
     405            'item_id'          => $user_id,
     406            'component_name'   => $component_name,
     407            'component_action' => $component_action
     408        )
     409    );
    394410}
    395411
Note: See TracChangeset for help on using the changeset viewer.