[ 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

since: 2.6.0 bbPress (r6109)
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

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

since: 2.6.0 bbPress (r6109)
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')

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

since: 2.6.0 bbPress (r6109)
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')

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

since: 2.6.0 bbPress (r6109)
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')

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

since: 2.6.0 bbPress (r6109)
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')

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

since: 2.6.0 bbPress (r6109)
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

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

since: 2.6.0 bbPress (r6109)
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')

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

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

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

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

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

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

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

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

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

since: 2.6.0 bbPress (r6320)
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

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.

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

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

since: 2.6.0 bbPress (r6320)
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

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.

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

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

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

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

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

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

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

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

since: 2.0.0 bbPress (r2652)
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

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.

since: 2.0.0 bbPress (r2652)
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

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

since: 2.0.0 bbPress (r2652)
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

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

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

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

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

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

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

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

since: 2.5.0 bbPress (r5156)
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

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

since: 2.5.0 bbPress (r5156)
since: 2.6.0 bbPress (r6544) Added $type parameter
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

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

since: 2.5.0 bbPress (r5156)
since: 2.6.0 bbPress (r6544) Added $type parameter
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

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

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

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.

since: 2.6.0 bbPress (r6606)
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

since: 2.5.0 bbPress (r5156)
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

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

since: 2.5.0 bbPress (r5156)
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

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

since: 2.5.0 bbPress (r5156)
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

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

since: 2.5.0 bbPress (r5156)
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

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

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

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.

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

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

since: 2.5.0 bbPress (r5156)



Generated: Thu Nov 21 01:01:27 2019 Cross-referenced by PHPXref 0.7.1