[ Index ]

PHP Cross Reference of BBPress

title

Body

[close]

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

bbPress User Engagement Functions

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

Defines 45 functions

  bbp_add_user_to_object()
  bbp_remove_user_from_object()
  bbp_remove_user_from_all_objects()
  bbp_remove_object_from_all_users()
  bbp_remove_all_users_from_all_objects()
  bbp_get_users_for_object()
  bbp_is_object_of_user()
  bbp_get_user_object_query()
  bbp_get_topic_engagements()
  bbp_get_topic_engagements_raw()
  bbp_get_user_engagements()
  bbp_is_user_engaged()
  bbp_add_user_engagement()
  bbp_remove_user_engagement()
  bbp_recalculate_topic_engagements()
  bbp_update_topic_engagements()
  bbp_get_topic_favoriters()
  bbp_get_user_favorites()
  bbp_is_user_favorite()
  bbp_add_user_favorite()
  bbp_remove_user_favorite()
  bbp_favorites_handler()
  bbp_get_subscribers()
  bbp_get_user_topic_subscriptions()
  bbp_get_user_forum_subscriptions()
  bbp_is_user_subscribed()
  bbp_add_user_subscription()
  bbp_remove_user_subscription()
  bbp_subscriptions_handler()
  bbp_get_user_object_ids()
  bbp_get_moderator_forum_ids()
  bbp_get_user_engaged_topic_ids()
  bbp_get_user_favorites_topic_ids()
  bbp_get_user_subscribed_forum_ids()
  bbp_get_user_subscribed_topic_ids()
  bbp_get_user_subscriptions()
  bbp_get_forum_subscribers()
  bbp_get_topic_subscribers()
  bbp_is_user_subscribed_to_forum()
  bbp_is_user_subscribed_to_topic()
  bbp_remove_user_forum_subscription()
  bbp_remove_user_topic_subscription()
  bbp_add_user_forum_subscription()
  bbp_add_user_topic_subscription()
  bbp_forum_subscriptions_handler()

Functions
Functions that are not part of a class:

bbp_add_user_to_object( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post', $unique = false )   X-Ref
Add a user id to an object

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

bbp_remove_user_from_object( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post' )   X-Ref
Remove a user id from an object

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

bbp_remove_user_from_all_objects( $user_id = 0, $rel_key = '', $rel_type = 'post' )   X-Ref
Remove a user id from all objects

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

bbp_remove_object_from_all_users( $object_id = 0, $rel_key = '', $rel_type = 'post' )   X-Ref
Remove an object from all users

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

bbp_remove_all_users_from_all_objects( $rel_key = '', $rel_type = 'post' )   X-Ref
Remove all users from all objects

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

bbp_get_users_for_object( $object_id = 0, $rel_key = '', $rel_type = 'post' )   X-Ref
Get users of an object

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

bbp_is_object_of_user( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post' )   X-Ref
Check if an object has a specific user

param: int    $object_id The object id
param: int    $user_id   The user id
param: string $rel_key   The relationship key
param: string $rel_type  The relationship type (usually 'post')
return: bool Returns true if object has a user, false if not
since: 2.6.0 bbPress (r6109)

bbp_get_user_object_query( $args = array()   X-Ref
Get the query part responsible for JOINing objects to user IDs

param: array  $args      Default query arguments
param: string $context   Additional context
param: string $rel_key   The relationship key
param: string $rel_type  The relationship type (usually 'post')
return: array
since: 2.6.0 bbPress (r6747)

bbp_get_topic_engagements( $topic_id = 0 )   X-Ref
Get the users who have engaged in a topic

param: int $topic_id Optional. Topic id
return: array|bool Results if the topic has any engagements, otherwise false
since: 2.6.0 bbPress (r6320)

bbp_get_topic_engagements_raw( $topic_id = 0 )   X-Ref
Return the users who have engaged in a topic, directly with a database query

See: https://bbpress.trac.wordpress.org/ticket/3083

param: int $topic_id
return: array
since: 2.6.0 bbPress (r6522)

bbp_get_user_engagements( $args = array()   X-Ref
Get a user's topic engagements

param: array $args Optional. Arguments to pass into bbp_has_replies()
return: bool True if user has engaged, otherwise false
since: 2.6.0 bbPress (r6320)
since: 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments

bbp_is_user_engaged( $user_id = 0, $topic_id = 0 )   X-Ref
Check if a user is engaged in a topic or not

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic is in user's engagements, otherwise false
since: 2.6.0 bbPress (r6320)

bbp_add_user_engagement( $user_id = 0, $topic_id = 0 )   X-Ref
Add a topic to user's engagements

Note that both the User and Topic should be verified to exist before using
this function. Originally both were validated, but because this function is
frequently used within a loop, those verifications were moved upstream to
improve performance on topics with many engaged users.

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool Always true
since: 2.6.0 bbPress (r6320)

bbp_remove_user_engagement( $user_id = 0, $topic_id = 0 )   X-Ref
Remove a topic from user's engagements

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic was removed from user's engagements, otherwise
since: 2.6.0 bbPress (r6320)

bbp_recalculate_topic_engagements( $topic_id = 0, $force = false )   X-Ref
Recalculate all of the users who have engaged in a topic.

This happens when permanently deleting a reply, because that reply author may
have authored other replies to that same topic, or the topic itself.

You may need to do this manually on heavily active forums where engagement
count accuracy is important.

param: int  $topic_id
param: bool $force
return: boolean True if any engagements are added, false otherwise
since: 2.6.0 bbPress (r6522)

bbp_update_topic_engagements( $topic_id = 0 )   X-Ref
Update the engagements of a topic.

Hooked to 'bbp_new_topic' and 'bbp_new_reply', this gets the post author and
if not anonymous, passes it into bbp_add_user_engagement().

param: int $topic_id
since: 2.6.0 bbPress (r6526)

bbp_get_topic_favoriters( $topic_id = 0 )   X-Ref
Get the users who have made the topic favorite

param: int $topic_id Optional. Topic id
return: array|bool Results if the topic has any favoriters, otherwise false
since: 2.0.0 bbPress (r2658)

bbp_get_user_favorites( $args = array()   X-Ref
Get a user's favorite topics

param: array $args Optional. Arguments to pass into bbp_has_topics()
return: array Array of topics if user has favorites, otherwise empty array
since: 2.0.0 bbPress (r2652)
since: 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments

bbp_is_user_favorite( $user_id = 0, $topic_id = 0 )   X-Ref
Check if a topic is in user's favorites or not

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic is in user's favorites, otherwise false
since: 2.0.0 bbPress (r2652)

bbp_add_user_favorite( $user_id = 0, $topic_id = 0 )   X-Ref
Add a topic to user's favorites

Note that both the User and Topic should be verified to exist before using
this function. Originally both were validated, but because this function is
frequently used within a loop, those verifications were moved upstream to
improve performance on topics with many engaged users.

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic was added to user's favorites, otherwise false
since: 2.0.0 bbPress (r2652)

bbp_remove_user_favorite( $user_id, $topic_id )   X-Ref
Remove a topic from user's favorites

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic was removed from user's favorites, otherwise false
since: 2.0.0 bbPress (r2652)

bbp_favorites_handler( $action = '' )   X-Ref
Handles the front end adding and removing of favorite topics

param: string $action The requested action to compare this function to

bbp_get_subscribers( $object_id = 0, $type = 'post' )   X-Ref
Get the users who have subscribed

param: int $object_id Optional. ID of object (forum, topic, or something else)
since: 2.6.0 bbPress (r5156)

bbp_get_user_topic_subscriptions( $args = array()   X-Ref
Get a user's subscribed topics

param: array $args Optional. Arguments to pass into bbp_has_topics()
return: array Array of topics if user has topic subscriptions, otherwise empty array
since: 2.0.0 bbPress (r2668)
since: 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments

bbp_get_user_forum_subscriptions( $args = array()   X-Ref
Get a user's subscribed forums

param: array $args Optional. Arguments to pass into bbp_has_forums()
return: array Array of forums if user has forum subscriptions, otherwise empty array
since: 2.5.0 bbPress (r5156)
since: 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments

bbp_is_user_subscribed( $user_id = 0, $object_id = 0, $type = 'post' )   X-Ref
Check if an object (forum or topic) is in user's subscription list or not

param: int $user_id Optional. User id
param: int $object_id Optional. Object id
return: bool True if the object (forum or topic) is in user's subscriptions, otherwise false
since: 2.5.0 bbPress (r5156)

bbp_add_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' )   X-Ref
Add a user subscription

param: int    $user_id   Optional. User id
param: int    $object_id Optional. Object id
param: string $type      Optional. Type of object being subscribed to
return: bool True if the object was added to user subscriptions, otherwise false
since: 2.5.0 bbPress (r5156)
since: 2.6.0 bbPress (r6544) Added $type parameter

bbp_remove_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' )   X-Ref
Remove a user subscription

param: int    $user_id   Optional. User id
param: int    $object_id Optional. Object id
param: string $type      Optional. Type of object being subscribed to
return: bool True if the object was removed from user subscriptions, otherwise false
since: 2.5.0 bbPress (r5156)
since: 2.6.0 bbPress (r6544) Added $type parameter

bbp_subscriptions_handler( $action = '' )   X-Ref
Handles the front end toggling of user subscriptions

param: string $action The requested action to compare this function to
since: 2.0.0 bbPress (r2790)
since: 2.6.l bbPress (r6543)

bbp_get_user_object_ids( $args = array()   X-Ref
Get a user's object IDs

For the most part, you should not need to use this function, and may even
want to come up with a more efficient way to get IDs on your own. Nevertheless,
it is available here for your convenience, using the most efficient query
parameters available inside of the various query APIs.

param: int    $user_id   The user id
param: string $rel_key   The relationship key
param: string $rel_type  The relationship type (usually 'post')
param: array  $args      The arguments to override defaults
return: array|bool Results if user has objects, otherwise null
since: 2.6.0 bbPress (r6606)

bbp_get_moderator_forum_ids( $user_id = 0 )   X-Ref
Get array of forum IDs that a user can moderate

param: int $user_id User id.
return: array Return array of forum ids, or empty array
since: 2.6.0 bbPress (r5834)

bbp_get_user_engaged_topic_ids( $user_id = 0 )   X-Ref
Get a user's engaged topic ids

param: int $user_id Optional. User id
return: array Return array of topic ids, or empty array
since: 2.6.0 bbPress (r6320)

bbp_get_user_favorites_topic_ids( $user_id = 0 )   X-Ref
Get a user's favorite topic ids

param: int $user_id Optional. User id
return: array Return array of favorite topic ids, or empty array
since: 2.0.0 bbPress (r2652)

bbp_get_user_subscribed_forum_ids( $user_id = 0 )   X-Ref
Get a user's subscribed forum ids

param: int $user_id Optional. User id
return: array Return array of subscribed forum ids, or empty array
since: 2.5.0 bbPress (r5156)

bbp_get_user_subscribed_topic_ids( $user_id = 0 )   X-Ref
Get a user's subscribed topic ids

param: int $user_id Optional. User id
return: array Return array of subscribed topic ids, or empty array
since: 2.0.0 bbPress (r2668)

bbp_get_user_subscriptions( $user_id = 0 )   X-Ref
Get a user's subscribed topics

param: int $user_id Optional. User id
return: array|bool Results if user has subscriptions, otherwise false
since: 2.0.0 bbPress (r2668)

bbp_get_forum_subscribers( $forum_id = 0 )   X-Ref
Get the users who have subscribed to the forum

param: int $forum_id Optional. forum id
return: array|bool Results if the forum has any subscribers, otherwise false
since: 2.5.0 bbPress (r5156)

bbp_get_topic_subscribers( $topic_id = 0 )   X-Ref
Get the users who have subscribed to the topic

param: int $topic_id Optional. Topic id
return: array|bool Results if the topic has any subscribers, otherwise false
since: 2.0.0 bbPress (r2668)

bbp_is_user_subscribed_to_forum( $user_id = 0, $forum_id = 0 )   X-Ref
Check if a forum is in user's subscription list or not

param: int $user_id  Optional. User id
param: int $forum_id Optional. Forum id
return: bool True if the forum is in user's subscriptions, otherwise false
since: 2.5.0 bbPress (r5156)

bbp_is_user_subscribed_to_topic( $user_id = 0, $topic_id = 0 )   X-Ref
Check if a topic is in user's subscription list or not

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic is in user's subscriptions, otherwise false
since: 2.5.0 bbPress (r5156)

bbp_remove_user_forum_subscription( $user_id = 0, $forum_id = 0 )   X-Ref
Remove a forum from user's subscriptions

param: int $user_id Optional. User id
param: int $forum_id Optional. forum id
return: bool True if the forum was removed from user's subscriptions,
since: 2.5.0 bbPress (r5156)

bbp_remove_user_topic_subscription( $user_id = 0, $topic_id = 0 )   X-Ref
Remove a topic from user's subscriptions

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool True if the topic was removed from user's subscriptions,
since: 2.5.0 bbPress (r5156)

bbp_add_user_forum_subscription( $user_id = 0, $forum_id = 0 )   X-Ref
Add a forum to user's subscriptions

param: int $user_id Optional. User id
param: int $forum_id Optional. forum id
return: bool Always true
since: 2.5.0 bbPress (r5156)

bbp_add_user_topic_subscription( $user_id = 0, $topic_id = 0 )   X-Ref
Add a topic to user's subscriptions

Note that both the User and Topic should be verified to exist before using
this function. Originally both were validated, but because this function is
frequently used within a loop, those verifications were moved upstream to
improve performance on topics with many engaged users.

param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
return: bool Always true
since: 2.0.0 bbPress (r2668)

bbp_forum_subscriptions_handler( $action = '' )   X-Ref
Handles the front end toggling of forum subscriptions

since: 2.5.0 bbPress (r5156)



Generated: Mon Jan 27 01:01:30 2020 Cross-referenced by PHPXref 0.7.1