[ 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: 895 lines (33 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 25 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_all_notifications_by_type()
  bp_notifications_delete_notifications_from_user()
  bp_notifications_delete_notifications_on_user_delete()
  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_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
param: array $args {
return: int|bool ID of the newly created notification on success, false

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

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

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

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

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
param: int      $id     ID of the notification.
param: int|bool $is_new 0 for read, 1 for unread.
return: false|int True on success, false on failure.

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
param: int $user_id ID of the user whose notifications are being fetched.
return: array $notifications Array of notifications for user.

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
param: int $user_id ID of the user whose notifications are being fetched.
return: array $notifications

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

since: 1.9.0
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.

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

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

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

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

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

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

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

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

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

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

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
param: int $user_id ID of the user whose unread notifications are being
return: int Unread notification count.

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

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

since: 2.3.0
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.

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

since: 1.2.0
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

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

since: 2.3.0
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.

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
param: string $email_address  The users email address.
param: int    $page           Batch number.
return: array An array of personal data.



Generated: Mon Nov 18 01:01:37 2019 Cross-referenced by PHPXref 0.7.1