Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/30/2013 06:39:07 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Add deprecated notices to Core notifications functions. Hat-tip boonebgorges, r-a-y. See #5266.

File:
1 edited

Legend:

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

    r7533 r7627  
    1616/**
    1717 * Add a notification for a specific user, from a specific component
     18 *
     19 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     20 *  bp_notifications_add_notification() instead.
    1821 *
    1922 * @since BuddyPress (1.0)
     
    3336        return false;
    3437    }
     38
     39    // Trigger the deprecated function notice
     40    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_add_notification()' );
    3541
    3642    // Notifications must always have a time
     
    5460 * Delete a specific notification by its ID
    5561 *
     62 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     63 *  bp_notifications_delete_notification() instead.
     64 *
    5665 * @since BuddyPress (1.0)
    5766 * @param int $id
     
    6574    }
    6675
     76    // Trigger the deprecated function notice
     77    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_delete_notification()' );
     78
    6779    return BP_Notifications_Notification::delete_by_id( $id );
    6880}
     
    7082/**
    7183 * Get a specific notification by its ID
     84 *
     85 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     86 *  bp_notifications_get_notification() instead.
    7287 *
    7388 * @since BuddyPress (1.0)
     
    8297    }
    8398
     99    // Trigger the deprecated function notice
     100    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_get_notification()' );
     101
    84102    return bp_notifications_get_notification( $id );
    85103}
     
    87105/**
    88106 * Get notifications for a specific user
     107 *
     108 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     109 *  bp_notifications_get_notifications_for_user() instead.
    89110 *
    90111 * @since BuddyPress (1.0)
     
    101122    }
    102123
     124    // Trigger the deprecated function notice
     125    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_get_notifications_for_user()' );
     126
    103127    $renderable = bp_notifications_get_notifications_for_user( $user_id, $format );
    104128
     
    114138 * has visited that component.
    115139 *
     140 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     141 *  bp_notifications_delete_notifications_by_type() instead.
     142 *
    116143 * @since BuddyPress (1.0)
    117144 * @param int $user_id
     
    126153        return false;
    127154    }
     155
     156    // Trigger the deprecated function notice
     157    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_delete_notifications_by_type()' );
    128158
    129159    return bp_notifications_delete_notifications_by_type( $user_id, $component_name, $component_action );
     
    136166 * has visited that component.
    137167 *
     168 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     169 *  bp_notifications_delete_notifications_by_item_id() instead.
     170 *
    138171 * @since BuddyPress (1.0)
    139172 * @param int $user_id
     
    149182    }
    150183
     184    // Trigger the deprecated function notice
     185    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_delete_notifications_by_item_id()' );
     186
    151187    return bp_notifications_delete_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id );
    152188}
     
    155191 * Delete all notifications for by type
    156192 *
     193 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     194 *  bp_notifications_delete_all_notifications_by_type() instead.
     195 *
    157196 * @since BuddyPress (1.0)
    158197 * @param int $user_id
     
    168207    }
    169208
     209    // Trigger the deprecated function notice
     210    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_delete_all_notifications_by_type()' );
     211
    170212    bp_notifications_delete_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id );
    171213}
     
    176218 * Used when clearing out all notifications for a user, whene deleted or spammed
    177219 *
     220 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     221 *  bp_notifications_delete_notifications_from_user() instead.
     222 *
    178223 * @since BuddyPress (1.0)
    179224 * @param int $user_id
     
    189234    }
    190235
     236    // Trigger the deprecated function notice
     237    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_delete_notifications_from_user()' );
     238
    191239    return bp_notifications_delete_notifications_from_user( $user_id, $component_name, $component_action );
    192240}
    193241
    194 /** Mark **********************************************************************/
    195 
    196 /**
    197  * Delete notifications for a user by type
    198  *
    199  * Used when clearing out notifications for a specific component when the user
    200  * has visited that component.
    201  *
    202  * @since BuddyPress (1.9.0)
    203  * @param int $user_id
    204  * @param string $component_name
    205  * @param string $component_action
    206  * @param int $is_new
    207  * @return boolean True on success, false on fail
    208  */
    209 function bp_core_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new = false ) {
    210 
    211     // Bail if notifications is not active
    212     if ( ! bp_is_active( 'notifications' ) ) {
    213         return false;
    214     }
    215 
    216     return bp_notifications_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new );
    217 }
    218 
    219 /**
    220  * Delete notifications for an item ID
    221  *
    222  * Used when clearing out notifications for a specific component when the user
    223  * has visited that component.
    224  *
    225  * @since BuddyPress (1.9.0)
    226  * @param int $user_id
    227  * @param string $component_name
    228  * @param string $component_action
    229  * @param int $is_new
    230  * @return boolean True on success, false on fail
    231  */
    232 function bp_core_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false, $is_new = false ) {
    233 
    234     // Bail if notifications is not active
    235     if ( ! bp_is_active( 'notifications' ) ) {
    236         return false;
    237     }
    238 
    239     return bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id, $is_new );
    240 }
    241 
    242 /**
    243  * Mark all notifications read/unread for by type
    244  *
    245  * Used when clearing out notifications for an entire component
    246  *
    247  * @since BuddyPress (1.9.0)
    248  * @param int $user_id
    249  * @param string $component_name
    250  * @param string $component_action
    251  * @return boolean True on success, false on fail
    252  */
    253 function bp_core_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false ) {
    254 
    255     // Bail if notifications is not active
    256     if ( ! bp_is_active( 'notifications' ) ) {
    257         return false;
    258     }
    259 
    260     bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action, $secondary_item_id, $is_new );
    261 }
    262 
    263 /**
    264  * Mark all notifications read/unread from a user
    265  *
    266  * @since BuddyPress (1.9.0)
    267  * @param int $user_id
    268  * @param string $component_name
    269  * @param string $component_action
    270  * @return boolean True on success, false on fail
    271  */
    272 function bp_core_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new = false ) {
    273 
    274     // Bail if notifications is not active
    275     if ( ! bp_is_active( 'notifications' ) ) {
    276         return false;
    277     }
    278 
    279     return bp_notifications_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new );
    280 }
    281 
    282242/** Helpers *******************************************************************/
    283243
     
    287247 * Used before deleting a notification for a user
    288248 *
     249 * @deprecated Deprecated since BuddyPress 1.9.0. Use
     250 *  bp_notifications_check_notification_access() instead.
     251 *
    289252 * @since BuddyPress (1.0)
    290253 * @param int $user_id
     
    299262    }
    300263
     264    // Trigger the deprecated function notice
     265    _deprecated_function( __FUNCTION__, '1.9', 'bp_notifications_check_notification_access()' );
     266
    301267    return bp_notifications_check_notification_access( $user_id, $notification_id );
    302268}
Note: See TracChangeset for help on using the changeset viewer.