[ Index ]

PHP Cross Reference of BBPress

title

Body

[close]

/src/includes/common/ -> engagements.php (summary)

bbPress Common Engagements This file contains the common classes and functions for interacting with the bbPress engagements API. See `includes/users/engagements.php` for more.

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

Defines 4 classes

BBP_User_Engagements_Base:: (7 methods):
  add_user_to_object()
  remove_user_from_object()
  remove_user_from_all_objects()
  remove_object_from_all_users()
  remove_all_users_from_all_objects()
  get_users_for_object()
  get_query()

BBP_User_Engagements_Meta:: (7 methods):
  add_user_to_object()
  remove_user_from_object()
  remove_user_from_all_objects()
  remove_object_from_all_users()
  remove_all_users_from_all_objects()
  get_users_for_object()
  get_query()

BBP_User_Engagements_Term:: (8 methods):
  jit_taxonomy()
  add_user_to_object()
  remove_user_from_object()
  remove_user_from_all_objects()
  remove_object_from_all_users()
  remove_all_users_from_all_objects()
  get_users_for_object()
  get_query()

BBP_User_Engagements_User:: (13 methods):
  get_user_option_key()
  get_cache_key()
  cache_get()
  cache_set()
  cache_delete()
  parse_comma_list()
  add_user_to_object()
  remove_user_from_object()
  remove_user_from_all_objects()
  remove_object_from_all_users()
  remove_all_users_from_all_objects()
  get_users_for_object()
  get_query()

Defines 13 functions

  bbp_user_engagements_interface()

Class: BBP_User_Engagements_Base  - X-Ref

Base strategy class for interfacing with User Engagements, which other
classes will extend.

add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false )   X-Ref
Add a user id to an object

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')
param: bool   $unique    Whether meta key should be unique to the object

remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from an object

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from all objects

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove an object from all users

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' )   X-Ref
Remove all users from all objects

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Get users of an object

since: 2.6.0 bbPress (r6722)
return: array Returns ids of users
param: int    $object_id The object id
param: string $meta_key  The key used to index this relationship
param: string $meta_type The type of meta to look in

get_query( $args = array()   X-Ref
Get the part of the query responsible for JOINing objects to relationships.

since: 2.6.0 bbPress (r6737)
return: array
param: array  $args
param: string $meta_key
param: string $meta_type

Class: BBP_User_Engagements_Meta  - X-Ref

Meta strategy for interfacing with User Engagements

add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false )   X-Ref
Add a user id to an object

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')
param: bool   $unique    Whether meta key should be unique to the object

remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from an object

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from all objects

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove an object from all users

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' )   X-Ref
Remove all users from all objects

since: 2.6.0 bbPress (r6722)
return: bool Returns true on success, false on failure
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Get users of an object

since: 2.6.0 bbPress (r6722)
return: array Returns ids of users
param: int    $object_id The object id
param: string $meta_key  The key used to index this relationship
param: string $meta_type The type of meta to look in

get_query( $args = array()   X-Ref
Get the part of the query responsible for JOINing objects to relationships.

since: 2.6.0 bbPress (r6737)
return: array
param: array  $args
param: string $meta_key
param: string $meta_type

Class: BBP_User_Engagements_Term  - X-Ref

Term strategy for interfacing with User Engagements

jit_taxonomy( $tax_key = '', $object_type = 'user' )   X-Ref
Register an engagement taxonomy just-in-time for immediate use

since: 2.6.0 bbPress (r6737)
param: string $tax_key
param: string $object_type

add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false )   X-Ref
Add a user id to an object

since: 2.6.0 bbPress (r6737)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')
param: bool   $unique    Whether meta key should be unique to the object

remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from an object

since: 2.6.0 bbPress (r6737)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from all objects

since: 2.6.0 bbPress (r6737)
return: bool Returns true on success, false on failure
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove an object from all users

since: 2.6.0 bbPress (r6737)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' )   X-Ref
Remove all users from all objects

since: 2.6.0 bbPress (r6737)
return: bool Returns true on success, false on failure
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Get users of an object

since: 2.6.0 bbPress (r6737)
return: array Returns ids of users
param: int    $object_id The object id
param: string $meta_key  The key used to index this relationship
param: string $meta_type The type of meta to look in

get_query( $args = array()   X-Ref
Get the part of the query responsible for JOINing objects to relationships.

since: 2.6.0 bbPress (r6737)
return: array
param: array  $args
param: string $meta_key
param: string $meta_type

Class: BBP_User_Engagements_User  - X-Ref

User strategy for interfacing with User Engagements

This strategy largely exists for backwards compatibility with bbPress 2.5,
or installations that have not upgraded their databases to 2.6 or above.

Note: this strategy is going to be a bit less tidy than the others, because
it needs to do weird things to maintain the 2.5 status-quo. Do not use this
strategy as an example when building your own.

get_user_option_key( $meta_key = '', $object_id = 0, $prefix = false )   X-Ref
Private function to map 2.6 meta keys to 2.5 user-option keys.

since: 2.6.0 bbPress (r6844)
return: string
param: string $meta_key
param: int    $object_id
param: bool   $prefix

get_cache_key( $meta_key = '', $object_id = 0 )   X-Ref
Private function to get a 2.5 compatible cache key.

This method exists to provide backwards compatibility with bbPress 2.5,
which had caching surrounding the FIND_IN_SET usermeta queries.

since: 2.6.3 bbPress (r6991)
return: string
param: string $meta_key
param: int    $object_id

cache_get( $meta_key = '', $object_id = 0 )   X-Ref
Get the user engagement cache for a given meta key and object ID.

This method exists to provide backwards compatibility with bbPress 2.5,
which had caching surrounding the FIND_IN_SET queries in usermeta.

since: 2.6.3 bbPress (r6991)
return: mixed Results from cache get
param: string $meta_key
param: int    $object_id

cache_set( $meta_key = '', $object_id = 0, $user_ids = array()   X-Ref
Set the user engagement cache for a given meta key and object ID.

This method exists to provide backwards compatibility with bbPress 2.5,
which had caching surrounding the FIND_IN_SET queries in usermeta.

since: 2.6.3 bbPress (r6991)
return: mixed Results from cache set
param: string $meta_key
param: int    $object_id

cache_delete( $meta_key = '', $object_id = 0 )   X-Ref
Delete the user engagement cache for a given meta key and object ID.

This method exists to provide backwards compatibility with bbPress 2.5,
which had caching surrounding the FIND_IN_SET queries in usermeta.

since: 2.6.3 bbPress (r6991)
return: mixed Results from cache delete
param: string $meta_key
param: int    $object_id

parse_comma_list( $results = '' )   X-Ref
Turn a comma-separated string into an array of integers

since: 2.6.0 bbPress (r6844)
return: array
param: string $results

add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false )   X-Ref
Add a user id to an object

since: 2.6.0 bbPress (r6844)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')
param: bool   $unique    Whether meta key should be unique to the object

remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from an object

since: 2.6.0 bbPress (r6844)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove a user id from all objects

since: 2.6.0 bbPress (r6844)
return: bool Returns true on success, false on failure
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Remove an object from all users

since: 2.6.0 bbPress (r6844)
return: bool Returns true on success, false on failure
param: int    $object_id The object id
param: int    $user_id   The user id
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' )   X-Ref
Remove all users from all objects

since: 2.6.0 bbPress (r6844)
return: bool Returns true on success, false on failure
param: string $meta_key  The relationship key
param: string $meta_type The relationship type (usually 'post')

get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' )   X-Ref
Get users of an object

The database queries in this function were cached in bbPress versions
older than 2.6, but no longer are to avoid cache pollution.

since: 2.6.0 bbPress (r6844)
return: array Returns ids of users
param: int    $object_id The object id
param: string $meta_key  The key used to index this relationship
param: string $meta_type The type of meta to look in

get_query( $args = array()   X-Ref
Get the part of the query responsible for JOINing objects to relationships.

since: 2.6.0 bbPress (r6844)
return: array
param: array  $args
param: string $meta_key
param: string $meta_type

Functions
Functions that are not part of a class:

bbp_user_engagements_interface( $rel_key = '', $rel_type = 'post' )   X-Ref
Return the strategy used for storing user engagements

since: 2.6.0 bbPress (r6722)
return: string
param: string $rel_key  The key used to index this relationship
param: string $rel_type The type of meta to look in



Generated: Wed Sep 30 01:01:24 2020 Cross-referenced by PHPXref 0.7.1