[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-notifications/ -> bp-notifications-functions.php (summary)

BuddyPress Member Notifications Functions. Functions and filters used in the Notifications component.

File Size: 995 lines (36 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 30 functions

  bp_notifications_add_notification()
  bp_notifications_get_notification()
  bp_notifications_delete_notification()
  bp_notifications_mark_notification()
  bp_notifications_get_all_notifications_for_user()
  bp_notifications_get_grouped_notifications_for_user()
  bp_notifications_get_notifications_for_user()
  bp_notifications_delete_notifications_by_type()
  bp_notifications_delete_notifications_by_item_id()
  bp_notifications_delete_notifications_by_ids()
  bp_notifications_delete_notifications_by_item_ids()
  bp_notifications_delete_all_notifications_by_type()
  bp_notifications_delete_notifications_from_user()
  bp_notifications_delete_notifications_on_user_delete()
  bp_notifications_delete_notifications_on_delete_user()
  bp_notifications_mark_notifications_by_type()
  bp_notifications_mark_notifications_by_item_id()
  bp_notifications_mark_all_notifications_by_type()
  bp_notifications_mark_notifications_from_user()
  bp_notifications_mark_notifications_by_item_ids()
  bp_notifications_mark_notifications_by_ids()
  bp_notifications_check_notification_access()
  bp_notifications_get_unread_notification_count()
  bp_notifications_get_registered_components()
  bp_notifications_screen_settings()
  bp_notifications_delete_meta()
  bp_notifications_get_meta()
  bp_notifications_update_meta()
  bp_notifications_add_meta()
  bp_notifications_personal_data_exporter()

Functions
Functions that are not part of a class:

bp_notifications_add_notification( $args = array()   X-Ref
Add a notification for a specific user, from a specific component.

since: 1.9.0
return: int|bool ID of the newly created notification on success, false on failure.
param: array $args {

bp_notifications_get_notification( $id )   X-Ref
Get a specific notification by its ID.

since: 1.9.0
return: BP_Notifications_Notification Notification object for ID specified.
param: int $id ID of the notification.

bp_notifications_delete_notification( $id )   X-Ref
Delete a specific notification by its ID.

since: 1.9.0
return: false|int Integer on success, false on failure.
param: int $id ID of the notification to delete.

bp_notifications_mark_notification( $id, $is_new = false )   X-Ref
Mark notification read/unread for a user by ID.

Used when clearing out notifications for a specific notification item.

since: 1.9.0
return: false|int Number of rows updated on success, false on failure.
param: int      $id     ID of the notification.
param: int|bool $is_new 0 for read, 1 for unread.

bp_notifications_get_all_notifications_for_user( $user_id = 0 )   X-Ref
Get all notifications for a user and cache them.

since: 2.1.0
return: array $notifications Array of notifications for user.
param: int $user_id ID of the user whose notifications are being fetched.

bp_notifications_get_grouped_notifications_for_user( $user_id = 0 )   X-Ref
Get a user's unread notifications, grouped by component and action.

This function returns a list of notifications collapsed by component + action.
See BP_Notifications_Notification::get_grouped_notifications_for_user() for
more details.

since: 3.0.0
return: array $notifications
param: int $user_id ID of the user whose notifications are being fetched.

bp_notifications_get_notifications_for_user( $user_id, $format = 'string' )   X-Ref
Get notifications for a specific user.

since: 1.9.0
return: mixed Object or array on success, false on failure.
param: int    $user_id ID of the user whose notifications are being fetched.
param: string $format  Format of the returned values. 'string' returns HTML,

bp_notifications_delete_notifications_by_type( $user_id, $component_name, $component_action )   X-Ref
Delete notifications for a user by type.

Used when clearing out notifications for a specific component when the user
has visited that component.

since: 1.9.0
return: int|false True on success, false on failure.
param: int    $user_id          ID of the user whose notifications are being deleted.
param: string $component_name   Name of the associated component.
param: string $component_action Name of the associated action.

bp_notifications_delete_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false )   X-Ref
Delete notifications for an item ID.

Used when clearing out notifications for a specific component when the user
has visited that component.

since: 1.9.0
return: int|false True on success, false on failure.
param: int      $user_id           ID of the user whose notifications are being deleted.
param: int      $item_id           ID of the associated item.
param: string   $component_name    Name of the associated component.
param: string   $component_action  Name of the associated action.
param: int|bool $secondary_item_id ID of the secondary associated item.

bp_notifications_delete_notifications_by_ids( $ids )   X-Ref
Delete notifications by notification ids.

since: 10.0.0
return: int|false      The number of rows updated. False on error.
param: int[]     $ids IDs of the associated notifications.

bp_notifications_delete_notifications_by_item_ids( $user_id, $item_ids, $component_name, $component_action )   X-Ref
Delete notifications by item ids and user.

since: 10.0.0
return: int|false                   The number of rows updated. False on error.
param: int       $user_id          ID of the user whose notifications are being deleted.
param: int[]     $item_ids         IDs of the associated items.
param: string    $component_name   Name of the associated component.
param: string    $component_action Name of the associated action.

bp_notifications_delete_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false )   X-Ref
Delete all notifications by type.

Used when clearing out notifications for an entire component.

since: 1.9.0
return: int|false True on success, false on failure.
param: int         $item_id           ID of the user whose notifications are being deleted.
param: string      $component_name    Name of the associated component.
param: string|bool $component_action  Optional. Name of the associated action.
param: int|bool    $secondary_item_id Optional. ID of the secondary associated item.

bp_notifications_delete_notifications_from_user( $user_id, $component_name, $component_action )   X-Ref
Delete all notifications from a user.

Used when clearing out all notifications for a user, when deleted or spammed.

since: 1.9.0
return: int|false True on success, false on failure.
param: int    $user_id          ID of the user whose associated items are being deleted.
param: string $component_name   Name of the associated component.
param: string $component_action Name of the associated action.

bp_notifications_delete_notifications_on_user_delete( $user_id )   X-Ref
Delete a user's notifications when the user is deleted.

since: 2.5.0
return: int|false The number of rows deleted, or false on error.
param: int $user_id ID of the user who is about to be deleted.

bp_notifications_delete_notifications_on_delete_user( $user_id )   X-Ref
Deletes user notifications data on the 'delete_user' hook.

since: 6.0.0
param: int $user_id The ID of the deleted user.

bp_notifications_mark_notifications_by_type( $user_id, $component_name, $component_action, $is_new = false )   X-Ref
Mark notifications read/unread for a user by type.

Used when clearing out notifications for a specific component when the user
has visited that component.

since: 1.9.0
return: int|false True on success, false on failure.
param: int      $user_id          ID of the user whose notifications are being deleted.
param: string   $component_name   Name of the associated component.
param: string   $component_action Name of the associated action.
param: int|bool $is_new           0 for read, 1 for unread.

bp_notifications_mark_notifications_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false, $is_new = false )   X-Ref
Mark notifications read/unread for an item ID.

Used when clearing out notifications for a specific component when the user
has visited that component.

since: 1.9.0
return: int|false True on success, false on failure.
param: int      $user_id           ID of the user whose notifications are being deleted.
param: int      $item_id           ID of the associated item.
param: string   $component_name    Name of the associated component.
param: string   $component_action  Name of the associated action.
param: int|bool $secondary_item_id ID of the secondary associated item.
param: int|bool $is_new            0 for read, 1 for unread.

bp_notifications_mark_all_notifications_by_type( $item_id, $component_name, $component_action = false, $secondary_item_id = false, $is_new = false )   X-Ref
Mark all notifications read/unread by type.

Used when clearing out notifications for an entire component.

since: 1.9.0
return: int|false True on success, false on failure.
param: int         $item_id           ID of the user whose notifications are being deleted.
param: string      $component_name    Name of the associated component.
param: string|bool $component_action  Optional. Name of the associated action.
param: int|bool    $secondary_item_id Optional. ID of the secondary associated item.
param: int|bool    $is_new            0 for read, 1 for unread.

bp_notifications_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new = false )   X-Ref
Mark all notifications read/unread from a user.

Used when clearing out all notifications for a user, when deleted or spammed.

since: 1.9.0
return: int|false True on success, false on failure.
param: int      $user_id          ID of the user whose associated items are being deleted.
param: string   $component_name   Name of the associated component.
param: string   $component_action Name of the associated action.
param: int|bool $is_new           0 for read, 1 for unread.

bp_notifications_mark_notifications_by_item_ids( $user_id, $item_ids, $component_name, $component_action, $is_new = false )   X-Ref
Mark notifications read/unread by item ids and user.

since: 10.0.0
return: int|false                   The number of rows updated. False on error.
param: int       $user_id          ID of the user whose notifications are being deleted.
param: int[]     $item_ids         IDs of the associated items.
param: string    $component_name   Name of the associated component.
param: string    $component_action Name of the associated action.
param: int|false $is_new           0 for read, 1 for unread.

bp_notifications_mark_notifications_by_ids( $ids, $is_new = false )   X-Ref
Mark notifications read/unread by notification ids.

since: 10.0.0
return: int|false          The number of rows updated. False on error.
param: int[]     $ids     IDs of the associated notification items.
param: int|false $is_new  0 for read, 1 for unread.

bp_notifications_check_notification_access( $user_id, $notification_id )   X-Ref
Check if a user has access to a specific notification.

Used before deleting a notification for a user.

since: 1.9.0
return: bool True if the notification belongs to the user, otherwise false.
param: int $user_id         ID of the user being checked.
param: int $notification_id ID of the notification being checked.

bp_notifications_get_unread_notification_count( $user_id = 0 )   X-Ref
Get a count of unread notification items for a user.

since: 1.9.0
return: int Unread notification count.
param: int $user_id ID of the user whose unread notifications are being

bp_notifications_get_registered_components()   X-Ref
Return an array of component names that are currently active and have
registered Notifications callbacks.

since: 1.9.1
return: array $component_names Array of registered components.

bp_notifications_screen_settings()   X-Ref
Catch and route the 'settings' notifications screen.

This is currently unused.

since: 1.9.0

bp_notifications_delete_meta( $notification_id, $meta_key = '', $meta_value = '', $delete_all = false )   X-Ref
Delete a meta entry from the DB for a notification item.

since: 2.3.0
return: bool                   True on success, false on failure.
param: int    $notification_id ID of the notification item whose metadata is being deleted.
param: string $meta_key        Optional. The key of the metadata being deleted. If
param: string $meta_value      Optional. If present, the metadata will only be
param: bool   $delete_all      Optional. If true, delete matching metadata entries

bp_notifications_get_meta( $notification_id = 0, $meta_key = '', $single = true )   X-Ref
Get metadata for a given notification item.

since: 2.3.0
return: mixed                  The meta value(s) being requested.
param: int    $notification_id ID of the notification item whose metadata is being requested.
param: string $meta_key        Optional. If present, only the metadata matching
param: bool   $single          Optional. If true, return only the first value of the

bp_notifications_update_meta( $notification_id, $meta_key, $meta_value, $prev_value = '' )   X-Ref
Update a piece of notification meta.

since: 1.2.0
return: bool|int                Returns false on failure. On successful
param: int    $notification_id ID of the notification item whose metadata is being
param: string $meta_key        Key of the metadata being updated.
param: mixed  $meta_value      Value to be set.
param: mixed  $prev_value      Optional. If specified, only update existing

bp_notifications_add_meta( $notification_id, $meta_key, $meta_value, $unique = false )   X-Ref
Add a piece of notification metadata.

since: 2.3.0
return: int|bool               The meta ID on successful update, false on failure.
param: int    $notification_id ID of the notification item.
param: string $meta_key        Metadata key.
param: mixed  $meta_value      Metadata value.
param: bool   $unique          Optional. Whether to enforce a single metadata value

bp_notifications_personal_data_exporter( $email_address, $page )   X-Ref
Finds and exports personal data associated with an email address from the Notifications tables.

since: 4.0.0
return: array An array of personal data.
param: string $email_address  The users email address.
param: int    $page           Batch number.



Generated: Tue Oct 15 01:00:54 2024 Cross-referenced by PHPXref 0.7.1