[ 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.

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

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

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

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

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

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.

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

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

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

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.

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

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

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

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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

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

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

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.
return: int|false                   The number of rows updated. False on error.
since: 10.0.0

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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

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

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

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

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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.

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.
return: int|false True on success, false on failure.
since: 1.9.0

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.

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.
return: int|false                   The number of rows updated. False on error.
since: 10.0.0

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

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

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.

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

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

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

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

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

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.

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
return: bool                   True on success, false on failure.
since: 2.3.0

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

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
return: mixed                  The meta value(s) being requested.
since: 2.3.0

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

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
return: bool|int                Returns false on failure. On successful
since: 1.2.0

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

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
return: int|bool               The meta ID on successful update, false on failure.
since: 2.3.0

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

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



Generated: Fri Mar 29 01:01:02 2024 Cross-referenced by PHPXref 0.7.1