[ Index ]

PHP Cross Reference of BBPress

title

Body

[close]

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

bbPress User Engagement Functions

File Size: 1223 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

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

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 $rel_key   The relationship key
param: string $rel_type  The relationship type (usually 'post')
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

return: bool Returns true on success, false on failure
param: int    $user_id  The user id
param: string $rel_key  The relationship key
param: string $rel_type The relationship type (usually 'post')
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

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 $rel_key   The relationship key
param: string $rel_type  The relationship type (usually 'post')
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

return: bool Returns true on success, false on failure
param: string $rel_key  The relationship key
param: string $rel_type The relationship type (usually 'post')
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

return: array Returns ids of users
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
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

return: bool Returns true if object has a user, false if not
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')
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

return: array
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')
since: 2.6.0 bbPress (r6747)

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

return: array|bool Results if the topic has any engagements, otherwise false
param: int $topic_id Optional. Topic id
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

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

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

return: bool True if user has engaged, otherwise false
param: array $args Optional. Arguments to pass into bbp_has_replies()
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

return: bool True if the topic is in user's engagements, otherwise false
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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.

return: bool Always true
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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

return: bool True if the topic was removed from user's engagements, otherwise
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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.

return: boolean True if any engagements are added, false otherwise
param: int  $topic_id
param: bool $force
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

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

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

return: array Array of topics if user has favorites, otherwise empty array
param: array $args Optional. Arguments to pass into bbp_has_topics()
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

return: bool True if the topic is in user's favorites, otherwise false
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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.

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

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

return: bool True if the topic was removed from user's favorites, otherwise false
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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

return: array Array of topics if user has topic subscriptions, otherwise empty array
param: array $args Optional. Arguments to pass into bbp_has_topics()
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

return: array Array of forums if user has forum subscriptions, otherwise empty array
param: array $args Optional. Arguments to pass into bbp_has_forums()
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

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

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

return: bool True if the object was added to user subscriptions, otherwise false
param: int    $user_id   Optional. User id
param: int    $object_id Optional. Object id
param: string $type      Optional. Type of object being subscribed to
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

return: bool True if the object was removed from user subscriptions, otherwise false
param: int    $user_id   Optional. User id
param: int    $object_id Optional. Object id
param: string $type      Optional. Type of object being subscribed to
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.

return: array|bool Results if user has objects, otherwise null
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
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return: array|bool Results if the topic has any subscribers, otherwise false
param: int $topic_id Optional. Topic id
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

return: bool True if the forum is in user's subscriptions, otherwise false
param: int $user_id  Optional. User id
param: int $forum_id Optional. Forum id
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

return: bool True if the topic is in user's subscriptions, otherwise false
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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

return: bool True if the forum was removed from user's subscriptions,
param: int $user_id Optional. User id
param: int $forum_id Optional. forum id
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

return: bool True if the topic was removed from user's subscriptions,
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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

return: bool Always true
param: int $user_id Optional. User id
param: int $forum_id Optional. forum id
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.

return: bool Always true
param: int $user_id Optional. User id
param: int $topic_id Optional. Topic id
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: Wed Jul 24 01:01:31 2019 Cross-referenced by PHPXref 0.7.1