PluginProbe
bbPress / 2.6.19
bbPress v2.6.19
2.6.19 2.6.18 2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 All 74 releases
← All changes | includes/users/engagements.php +165 -167 trunk → 2.6.19 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 /**
4 - * bbPress User Engagement Functions.
4 + * bbPress User Engagement Functions
5 5 *
6 6 * @package bbPress
7 7 * @subpackage Engagements
8 8 */
@@ -12,19 +12,19 @@
12 12
13 13 /** User Relationships ********************************************************/
14 14
15 15 /**
16 - * Add a user id to an object.
16 + * Add a user id to an object
17 17 *
18 18 * @since 2.6.0 bbPress (r6109)
19 19 *
20 - * @param int $object_id The object id.
21 - * @param int $user_id The user id.
22 - * @param string $rel_key The relationship key.
23 - * @param string $rel_type The relationship type (usually 'post').
24 - * @param bool $unique Whether meta key should be unique to the object.
20 + * @param int $object_id The object id
21 + * @param int $user_id The user id
22 + * @param string $rel_key The relationship key
23 + * @param string $rel_type The relationship type (usually 'post')
24 + * @param bool $unique Whether meta key should be unique to the object
25 25 *
26 - * @return bool Returns true on success, false on failure.
26 + * @return bool Returns true on success, false on failure
27 27 */
28 28 function bbp_add_user_to_object( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post', $unique = false ) {
29 29 $object_id = absint( $object_id );
30 30 $user_id = absint( $user_id );
@@ -34,18 +34,18 @@
34 34 return (bool) apply_filters( 'bbp_add_user_to_object', $retval, $object_id, $user_id, $rel_key, $rel_type, $unique );
35 35 }
36 36
37 37 /**
38 - * Remove a user id from an object.
38 + * Remove a user id from an object
39 39 *
40 40 * @since 2.6.0 bbPress (r6109)
41 41 *
42 - * @param int $object_id The object id.
43 - * @param int $user_id The user id.
44 - * @param string $rel_key The relationship key.
45 - * @param string $rel_type The relationship type (usually 'post').
42 + * @param int $object_id The object id
43 + * @param int $user_id The user id
44 + * @param string $rel_key The relationship key
45 + * @param string $rel_type The relationship type (usually 'post')
46 46 *
47 - * @return bool Returns true on success, false on failure.
47 + * @return bool Returns true on success, false on failure
48 48 */
49 49 function bbp_remove_user_from_object( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post' ) {
50 50 $retval = bbp_user_engagements_interface( $rel_key, $rel_type )->remove_user_from_object( $object_id, $user_id, $rel_key, $rel_type );
51 51
@@ -53,17 +53,17 @@
53 53 return (bool) apply_filters( 'bbp_remove_user_from_object', $retval, $object_id, $user_id, $rel_key, $rel_type );
54 54 }
55 55
56 56 /**
57 - * Remove a user id from all objects.
57 + * Remove a user id from all objects
58 58 *
59 59 * @since 2.6.0 bbPress (r6517)
60 60 *
61 - * @param int $user_id The user id.
62 - * @param string $rel_key The relationship key.
63 - * @param string $rel_type The relationship type (usually 'post').
61 + * @param int $user_id The user id
62 + * @param string $rel_key The relationship key
63 + * @param string $rel_type The relationship type (usually 'post')
64 64 *
65 - * @return bool Returns true on success, false on failure.
65 + * @return bool Returns true on success, false on failure
66 66 */
67 67 function bbp_remove_user_from_all_objects( $user_id = 0, $rel_key = '', $rel_type = 'post' ) {
68 68 $user_id = absint( $user_id );
69 69 $retval = bbp_user_engagements_interface( $rel_key, $rel_type )->remove_user_from_all_objects( $user_id, $rel_key, $rel_type );
@@ -72,18 +72,18 @@
72 72 return (bool) apply_filters( 'bbp_remove_user_from_all_objects', $retval, $user_id, $rel_key, $rel_type );
73 73 }
74 74
75 75 /**
76 - * Remove an object from all users.
76 + * Remove an object from all users
77 77 *
78 78 * @since 2.6.0 bbPress (r6544)
79 79 *
80 - * @param int $object_id The object id.
81 - * @param int $user_id The user id.
82 - * @param string $rel_key The relationship key.
83 - * @param string $rel_type The relationship type (usually 'post').
80 + * @param int $object_id The object id
81 + * @param int $user_id The user id
82 + * @param string $rel_key The relationship key
83 + * @param string $rel_type The relationship type (usually 'post')
84 84 *
85 - * @return bool Returns true on success, false on failure.
85 + * @return bool Returns true on success, false on failure
86 86 */
87 87 function bbp_remove_object_from_all_users( $object_id = 0, $rel_key = '', $rel_type = 'post' ) {
88 88 $object_id = absint( $object_id );
89 89 $retval = bbp_user_engagements_interface( $rel_key, $rel_type )->remove_object_from_all_users( $object_id, $rel_key, $rel_type );
@@ -92,16 +92,16 @@
92 92 return (bool) apply_filters( 'bbp_remove_object_from_all_users', $retval, $object_id, $rel_key, $rel_type );
93 93 }
94 94
95 95 /**
96 - * Remove all users from all objects.
96 + * Remove all users from all objects
97 97 *
98 98 * @since 2.6.0 bbPress (r6520)
99 99 *
100 - * @param string $rel_key The relationship key.
101 - * @param string $rel_type The relationship type (usually 'post').
100 + * @param string $rel_key The relationship key
101 + * @param string $rel_type The relationship type (usually 'post')
102 102 *
103 - * @return bool Returns true on success, false on failure.
103 + * @return bool Returns true on success, false on failure
104 104 */
105 105 function bbp_remove_all_users_from_all_objects( $rel_key = '', $rel_type = 'post' ) {
106 106 $retval = bbp_user_engagements_interface( $rel_key, $rel_type )->remove_all_users_from_all_objects( $rel_key, $rel_type );
107 107
@@ -109,15 +109,15 @@
109 109 return (bool) apply_filters( 'bbp_remove_all_users_from_all_objects', $retval, $rel_key, $rel_type );
110 110 }
111 111
112 112 /**
113 - * Get users of an object.
113 + * Get users of an object
114 114 *
115 115 * @since 2.6.0 bbPress (r6109)
116 116 *
117 - * @param int $object_id The object id.
118 - * @param string $rel_key The key used to index this relationship.
119 - * @param string $rel_type The type of meta to look in.
117 + * @param int $object_id The object id
118 + * @param string $rel_key The key used to index this relationship
119 + * @param string $rel_type The type of meta to look in
120 120 *
121 121 * @return array Returns ids of users
122 122 */
123 123 function bbp_get_users_for_object( $object_id = 0, $rel_key = '', $rel_type = 'post' ) {
@@ -128,18 +128,18 @@
128 128 return (array) apply_filters( 'bbp_get_users_for_object', $retval, $object_id, $rel_key, $rel_type );
129 129 }
130 130
131 131 /**
132 - * Check if an object has a specific user.
132 + * Check if an object has a specific user
133 133 *
134 134 * @since 2.6.0 bbPress (r6109)
135 135 *
136 - * @param int $object_id The object id.
137 - * @param int $user_id The user id.
138 - * @param string $rel_key The relationship key.
139 - * @param string $rel_type The relationship type (usually 'post').
136 + * @param int $object_id The object id
137 + * @param int $user_id The user id
138 + * @param string $rel_key The relationship key
139 + * @param string $rel_type The relationship type (usually 'post')
140 140 *
141 - * @return bool Returns true if object has a user, false if not.
141 + * @return bool Returns true if object has a user, false if not
142 142 */
143 143 function bbp_is_object_of_user( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post' ) {
144 144 $object_id = absint( $object_id );
145 145 $user_id = absint( $user_id );
@@ -150,16 +150,16 @@
150 150 return (bool) apply_filters( 'bbp_is_object_of_user', $retval, $object_id, $user_id, $rel_key, $rel_type );
151 151 }
152 152
153 153 /**
154 - * Get the query part responsible for JOINing objects to user IDs.
154 + * Get the query part responsible for JOINing objects to user IDs
155 155 *
156 156 * @since 2.6.0 bbPress (r6739)
157 157 *
158 - * @param array $args Default query arguments.
159 - * @param string $context Additional context.
160 - * @param string $rel_key The relationship key.
161 - * @param string $rel_type The relationship type (usually 'post').
158 + * @param array $args Default query arguments
159 + * @param string $context Additional context
160 + * @param string $rel_key The relationship key
161 + * @param string $rel_type The relationship type (usually 'post')
162 162 *
163 163 * @return array
164 164 */
165 165 function bbp_get_user_object_query( $args = array(), $context = '', $rel_key = '', $rel_type = 'post' ) {
@@ -171,15 +171,15 @@
171 171
172 172 /** Engagements ***************************************************************/
173 173
174 174 /**
175 - * Get the users who have engaged in a topic.
175 + * Get the users who have engaged in a topic
176 176 *
177 177 * @since 2.6.0 bbPress (r6311)
178 178 *
179 - * @param int $topic_id Optional. Topic id.
179 + * @param int $topic_id Optional. Topic id
180 180 *
181 - * @return array|bool Results if the topic has any engagements, otherwise false.
181 + * @return array|bool Results if the topic has any engagements, otherwise false
182 182 */
183 183 function bbp_get_topic_engagements( $topic_id = 0 ) {
184 184 $topic_id = bbp_get_topic_id( $topic_id );
185 185 $users = bbp_get_users_for_object( $topic_id, '_bbp_engagement' );
@@ -188,16 +188,16 @@
188 188 return (array) apply_filters( 'bbp_get_topic_engagements', $users, $topic_id );
189 189 }
190 190
191 191 /**
192 - * Return the users who have engaged in a topic, directly with a database query.
192 + * Return the users who have engaged in a topic, directly with a database query
193 193 *
194 194 * See: https://bbpress.trac.wordpress.org/ticket/3083
195 195 *
196 196 * @since 2.6.0 bbPress (r6522)
197 - * @since 2.6.17 bbPress (r7467) Honor filtered public reply statuses.
197 + * @since 2.6.17 bbPress (r7468) Honor filtered public reply statuses.
198 198 *
199 - * @param int $topic_id Optional. Topic id.
199 + * @param int $topic_id
200 200 *
201 201 * @return array
202 202 */
203 203 function bbp_get_topic_engagements_raw( $topic_id = 0 ) {
@@ -238,16 +238,16 @@
238 238 return (array) apply_filters( 'bbp_get_topic_engagements_raw', $engagements, $topic_id );
239 239 }
240 240
241 241 /**
242 - * Get a user's topic engagements.
242 + * Get a user's topic engagements
243 243 *
244 244 * @since 2.6.0 bbPress (r6311)
245 245 * @since 2.6.0 bbPress (r6619) Signature changed to accept an array of arguments
246 246 *
247 - * @param array $args Optional. Arguments to pass into bbp_has_replies().
247 + * @param array $args Optional. Arguments to pass into bbp_has_replies()
248 248 *
249 - * @return bool True if user has engaged, otherwise false.
249 + * @return bool True if user has engaged, otherwise false
250 250 */
251 251 function bbp_get_user_engagements( $args = array() ) {
252 252 $r = bbp_get_user_object_query( $args, 'engagements', '_bbp_engagement' );
253 253 $query = bbp_has_topics( $r );
@@ -256,16 +256,16 @@
256 256 return apply_filters( 'bbp_get_user_engagements', $query, 0, $r, $args );
257 257 }
258 258
259 259 /**
260 - * Check if a user is engaged in a topic or not.
260 + * Check if a user is engaged in a topic or not
261 261 *
262 262 * @since 2.6.0 bbPress (r6311)
263 263 *
264 - * @param int $user_id Optional. User id.
265 - * @param int $topic_id Optional. Topic id.
264 + * @param int $user_id Optional. User id
265 + * @param int $topic_id Optional. Topic id
266 266 *
267 - * @return bool True if the topic is in user's engagements, otherwise false.
267 + * @return bool True if the topic is in user's engagements, otherwise false
268 268 */
269 269 function bbp_is_user_engaged( $user_id = 0, $topic_id = 0 ) {
270 270 $user_id = bbp_get_user_id( $user_id, true, true );
271 271 $topic_id = bbp_get_topic_id( $topic_id );
@@ -275,9 +275,9 @@
275 275 return (bool) apply_filters( 'bbp_is_user_engaged', $retval, $user_id, $topic_id );
276 276 }
277 277
278 278 /**
279 - * Add a topic to user's engagements.
279 + * Add a topic to user's engagements
280 280 *
281 281 * Note that both the User and Topic should be verified to exist before using
282 282 * this function. Originally both were validated, but because this function is
283 283 * frequently used within a loop, those verifications were moved upstream to
@@ -284,10 +284,10 @@
284 284 * improve performance on topics with many engaged users.
285 285 *
286 286 * @since 2.6.0 bbPress (r6311)
287 287 *
288 - * @param int $user_id Optional. User id.
289 - * @param int $topic_id Optional. Topic id.
288 + * @param int $user_id Optional. User id
289 + * @param int $topic_id Optional. Topic id
290 290 *
291 291 * @return bool Always true
292 292 */
293 293 function bbp_add_user_engagement( $user_id = 0, $topic_id = 0 ) {
@@ -312,17 +312,17 @@
312 312 return true;
313 313 }
314 314
315 315 /**
316 - * Remove a topic from user's engagements.
316 + * Remove a topic from user's engagements
317 317 *
318 318 * @since 2.6.0 bbPress (r6311)
319 319 *
320 - * @param int $user_id Optional. User id.
321 - * @param int $topic_id Optional. Topic id.
320 + * @param int $user_id Optional. User id
321 + * @param int $topic_id Optional. Topic id
322 322 *
323 323 * @return bool True if the topic was removed from user's engagements, otherwise
324 - * false.
324 + * false
325 325 */
326 326 function bbp_remove_user_engagement( $user_id = 0, $topic_id = 0 ) {
327 327
328 328 // Bail if not enough info
@@ -355,10 +355,10 @@
355 355 * count accuracy is important.
356 356 *
357 357 * @since 2.6.0 bbPress (r6522)
358 358 *
359 - * @param int $topic_id Topic id.
360 - * @param bool $force Force remove & add, even if old equals new.
359 + * @param int $topic_id
360 + * @param bool $force
361 361 *
362 362 * @return boolean True if any engagements are added, false otherwise
363 363 */
364 364 function bbp_recalculate_topic_engagements( $topic_id = 0, $force = false ) {
@@ -407,9 +407,9 @@
407 407 * if not anonymous, passes it into bbp_add_user_engagement().
408 408 *
409 409 * @since 2.6.0 bbPress (r6529)
410 410 *
411 - * @param int $topic_id Topic id.
411 + * @param int $topic_id
412 412 */
413 413 function bbp_update_topic_engagements( $topic_id = 0 ) {
414 414
415 415 // Is a reply
@@ -457,9 +457,9 @@
457 457 * the user must be able to read both a topic and its containing forum when
458 458 * adding an engagement. Existing engagements may be removed after visibility
459 459 * changes.
460 460 *
461 - * @since 2.6.19 bbPress (r7642)
461 + * @since 2.6.19 bbPress (r7643)
462 462 *
463 463 * @param int $object_id Post ID.
464 464 * @param string $object_type Metadata object type; only post is supported.
465 465 * @param string $engagement Favorite or subscription.
@@ -493,15 +493,15 @@
493 493
494 494 /** Favorites *****************************************************************/
495 495
496 496 /**
497 - * Get the users who have made the topic favorite.
497 + * Get the users who have made the topic favorite
498 498 *
499 499 * @since 2.0.0 bbPress (r2668)
500 500 *
501 - * @param int $topic_id Optional. Topic id.
501 + * @param int $topic_id Optional. Topic id
502 502 *
503 - * @return array|bool Results if the topic has any favoriters, otherwise false.
503 + * @return array|bool Results if the topic has any favoriters, otherwise false
504 504 */
505 505 function bbp_get_topic_favoriters( $topic_id = 0 ) {
506 506 $topic_id = bbp_get_topic_id( $topic_id );
507 507 $users = bbp_get_users_for_object( $topic_id, '_bbp_favorite' );
@@ -510,16 +510,16 @@
510 510 return (array) apply_filters( 'bbp_get_topic_favoriters', $users, $topic_id );
511 511 }
512 512
513 513 /**
514 - * Get a user's favorite topics.
514 + * Get a user's favorite topics
515 515 *
516 516 * @since 2.0.0 bbPress (r2652)
517 517 * @since 2.6.0 bbPress (r6619) Signature changed to accept an array of arguments
518 518 *
519 - * @param array $args Optional. Arguments to pass into bbp_has_topics().
519 + * @param array $args Optional. Arguments to pass into bbp_has_topics()
520 520 *
521 - * @return array Array of topics if user has favorites, otherwise empty array.
521 + * @return array Array of topics if user has favorites, otherwise empty array
522 522 */
523 523 function bbp_get_user_favorites( $args = array() ) {
524 524 $r = bbp_get_user_object_query( $args, 'favorites', '_bbp_favorite' );
525 525 $query = ! empty( $r )
@@ -530,16 +530,16 @@
530 530 return apply_filters( 'bbp_get_user_favorites', $query, 0, $r, $args );
531 531 }
532 532
533 533 /**
534 - * Check if a topic is in user's favorites or not.
534 + * Check if a topic is in user's favorites or not
535 535 *
536 536 * @since 2.0.0 bbPress (r2652)
537 537 *
538 - * @param int $user_id Optional. User id.
539 - * @param int $topic_id Optional. Topic id.
538 + * @param int $user_id Optional. User id
539 + * @param int $topic_id Optional. Topic id
540 540 *
541 - * @return bool True if the topic is in user's favorites, otherwise false.
541 + * @return bool True if the topic is in user's favorites, otherwise false
542 542 */
543 543 function bbp_is_user_favorite( $user_id = 0, $topic_id = 0 ) {
544 544 $retval = bbp_is_object_of_user( $topic_id, $user_id, '_bbp_favorite' );
545 545
@@ -547,9 +547,9 @@
547 547 return (bool) apply_filters( 'bbp_is_user_favorite', $retval, $user_id, $topic_id );
548 548 }
549 549
550 550 /**
551 - * Add a topic to user's favorites.
551 + * Add a topic to user's favorites
552 552 *
553 553 * Note that both the User and Topic should be verified to exist before using
554 554 * this function. Originally both were validated, but because this function is
555 555 * frequently used within a loop, those verifications were moved upstream to
@@ -556,12 +556,12 @@
556 556 * improve performance on topics with many engaged users.
557 557 *
558 558 * @since 2.0.0 bbPress (r2652)
559 559 *
560 - * @param int $user_id Optional. User id.
561 - * @param int $topic_id Optional. Topic id.
560 + * @param int $user_id Optional. User id
561 + * @param int $topic_id Optional. Topic id
562 562 *
563 - * @return bool True if the topic was added to user's favorites, otherwise false.
563 + * @return bool True if the topic was added to user's favorites, otherwise false
564 564 */
565 565 function bbp_add_user_favorite( $user_id = 0, $topic_id = 0 ) {
566 566 $user_id = bbp_get_user_id( $user_id, false, false );
567 567 $topic_id = bbp_get_topic_id( $topic_id );
@@ -586,16 +586,16 @@
586 586 return true;
587 587 }
588 588
589 589 /**
590 - * Remove a topic from user's favorites.
590 + * Remove a topic from user's favorites
591 591 *
592 592 * @since 2.0.0 bbPress (r2652)
593 593 *
594 - * @param int $user_id Optional. User id.
595 - * @param int $topic_id Optional. Topic id.
594 + * @param int $user_id Optional. User id
595 + * @param int $topic_id Optional. Topic id
596 596 *
597 - * @return bool True if the topic was removed from user's favorites, otherwise false.
597 + * @return bool True if the topic was removed from user's favorites, otherwise false
598 598 */
599 599 function bbp_remove_user_favorite( $user_id, $topic_id ) {
600 600 $user_id = bbp_get_user_id( $user_id, false, false );
601 601 $topic_id = bbp_get_topic_id( $topic_id );
@@ -620,13 +620,11 @@
620 620 return true;
621 621 }
622 622
623 623 /**
624 - * Handles the front end adding and removing of favorite topics.
624 + * Handles the front end adding and removing of favorite topics
625 625 *
626 - * @since 2.0.0 bbPress (r2660)
627 - *
628 - * @param string $action The requested action to compare this function to.
626 + * @param string $action The requested action to compare this function to
629 627 */
630 628 function bbp_favorites_handler( $action = '' ) {
631 629
632 630 // Default
@@ -719,13 +717,13 @@
719 717
720 718 /** Subscriptions *************************************************************/
721 719
722 720 /**
723 - * Get the users who have subscribed.
721 + * Get the users who have subscribed
724 722 *
725 723 * @since 2.6.0 bbPress (r6544)
726 724 *
727 - * @param int $object_id Optional. ID of object (forum, topic, or something else).
725 + * @param int $object_id Optional. ID of object (forum, topic, or something else)
728 726 */
729 727 function bbp_get_subscribers( $object_id = 0, $type = 'post' ) {
730 728 $users = bbp_get_users_for_object( $object_id, '_bbp_subscription', $type );
731 729
@@ -733,16 +731,16 @@
733 731 return (array) apply_filters( 'bbp_get_subscribers', $users, $object_id, $type );
734 732 }
735 733
736 734 /**
737 - * Get a user's subscribed topics.
735 + * Get a user's subscribed topics
738 736 *
739 737 * @since 2.5.0 bbPress (r5156)
740 738 * @since 2.6.0 bbPress (r6619) Signature changed to accept an array of arguments
741 739 *
742 - * @param array $args Optional. Arguments to pass into bbp_has_topics().
740 + * @param array $args Optional. Arguments to pass into bbp_has_topics()
743 741 *
744 - * @return array Array of topics if user has topic subscriptions, otherwise empty array.
742 + * @return array Array of topics if user has topic subscriptions, otherwise empty array
745 743 */
746 744 function bbp_get_user_topic_subscriptions( $args = array() ) {
747 745 $r = bbp_get_user_object_query( $args, 'topic_subscriptions', '_bbp_subscription' );
748 746 $query = ! empty( $r )
@@ -753,16 +751,16 @@
753 751 return apply_filters( 'bbp_get_user_topic_subscriptions', $query, 0, $r, $args );
754 752 }
755 753
756 754 /**
757 - * Get a user's subscribed forums.
755 + * Get a user's subscribed forums
758 756 *
759 757 * @since 2.5.0 bbPress (r5156)
760 758 * @since 2.6.0 bbPress (r6619) Signature changed to accept an array of arguments
761 759 *
762 - * @param array $args Optional. Arguments to pass into bbp_has_forums().
760 + * @param array $args Optional. Arguments to pass into bbp_has_forums()
763 761 *
764 - * @return array Array of forums if user has forum subscriptions, otherwise empty array.
762 + * @return array Array of forums if user has forum subscriptions, otherwise empty array
765 763 */
766 764 function bbp_get_user_forum_subscriptions( $args = array() ) {
767 765 $r = bbp_get_user_object_query( $args, 'forum_subscriptions', '_bbp_subscription' );
768 766 $query = ! empty( $r )
@@ -773,16 +771,16 @@
773 771 return apply_filters( 'bbp_get_user_forum_subscriptions', $query, 0, $r, $args );
774 772 }
775 773
776 774 /**
777 - * Check if an object (forum or topic) is in user's subscription list or not.
775 + * Check if an object (forum or topic) is in user's subscription list or not
778 776 *
779 777 * @since 2.0.0 bbPress (r2668)
780 778 *
781 - * @param int $user_id Optional. User id.
782 - * @param int $object_id Optional. Object id.
779 + * @param int $user_id Optional. User id
780 + * @param int $object_id Optional. Object id
783 781 *
784 - * @return bool True if the object (forum or topic) is in user's subscriptions, otherwise false.
782 + * @return bool True if the object (forum or topic) is in user's subscriptions, otherwise false
785 783 */
786 784 function bbp_is_user_subscribed( $user_id = 0, $object_id = 0, $type = 'post' ) {
787 785 $retval = bbp_is_object_of_user( $object_id, $user_id, '_bbp_subscription', $type );
788 786
@@ -790,18 +788,18 @@
790 788 return (bool) apply_filters( 'bbp_is_user_subscribed', $retval, $user_id, $object_id, $type );
791 789 }
792 790
793 791 /**
794 - * Add a user subscription.
792 + * Add a user subscription
795 793 *
796 794 * @since 2.0.0 bbPress (r2668)
797 795 * @since 2.6.0 bbPress (r6544) Added $type parameter
798 796 *
799 - * @param int $user_id Optional. User id.
800 - * @param int $object_id Optional. Object id.
801 - * @param string $type Optional. Type of object being subscribed to.
797 + * @param int $user_id Optional. User id
798 + * @param int $object_id Optional. Object id
799 + * @param string $type Optional. Type of object being subscribed to
802 800 *
803 - * @return bool True if the object was added to user subscriptions, otherwise false.
801 + * @return bool True if the object was added to user subscriptions, otherwise false
804 802 */
805 803 function bbp_add_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' ) {
806 804
807 805 // Bail if not enough info
@@ -824,18 +822,18 @@
824 822 return true;
825 823 }
826 824
827 825 /**
828 - * Remove a user subscription.
826 + * Remove a user subscription
829 827 *
830 828 * @since 2.0.0 bbPress (r2668)
831 829 * @since 2.6.0 bbPress (r6544) Added $type parameter
832 830 *
833 - * @param int $user_id Optional. User id.
834 - * @param int $object_id Optional. Object id.
835 - * @param string $type Optional. Type of object being subscribed to.
831 + * @param int $user_id Optional. User id
832 + * @param int $object_id Optional. Object id
833 + * @param string $type Optional. Type of object being subscribed to
836 834 *
837 - * @return bool True if the object was removed from user subscriptions, otherwise false.
835 + * @return bool True if the object was removed from user subscriptions, otherwise false
838 836 */
839 837 function bbp_remove_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' ) {
840 838
841 839 // Bail if not enough info
@@ -858,14 +856,14 @@
858 856 return true;
859 857 }
860 858
861 859 /**
862 - * Handles the front end toggling of user subscriptions.
860 + * Handles the front end toggling of user subscriptions
863 861 *
864 862 * @since 2.0.0 bbPress (r2668)
865 863 * @since 2.6.0 bbPress (r6544)
866 864 *
867 - * @param string $action The requested action to compare this function to.
865 + * @param string $action The requested action to compare this function to
868 866 */
869 867 function bbp_subscriptions_handler( $action = '' ) {
870 868
871 869 // Default
@@ -979,14 +977,14 @@
979 977 * parameters available inside of the various query APIs.
980 978 *
981 979 * @since 2.6.0 bbPress (r6607)
982 980 *
983 - * @param int $user_id The user id.
984 - * @param string $rel_key The relationship key.
985 - * @param string $rel_type The relationship type (usually 'post').
986 - * @param array $args The arguments to override defaults.
981 + * @param int $user_id The user id
982 + * @param string $rel_key The relationship key
983 + * @param string $rel_type The relationship type (usually 'post')
984 + * @param array $args The arguments to override defaults
987 985 *
988 - * @return array|bool Results if user has objects, otherwise null.
986 + * @return array|bool Results if user has objects, otherwise null
989 987 */
990 988 function bbp_get_user_object_ids( $args = array() ) {
991 989 $object_ids = $defaults = array();
992 990
@@ -1047,15 +1045,15 @@
1047 1045 return (array) apply_filters( "bbp_get_{$r['filter']}", $object_ids, $r, $args );
1048 1046 }
1049 1047
1050 1048 /**
1051 - * Get array of forum IDs that a user can moderate.
1049 + * Get array of forum IDs that a user can moderate
1052 1050 *
1053 1051 * @since 2.6.0 bbPress (r5834)
1054 1052 *
1055 1053 * @param int $user_id User id.
1056 1054 *
1057 - * @return array Return array of forum ids, or empty array.
1055 + * @return array Return array of forum ids, or empty array
1058 1056 */
1059 1057 function bbp_get_moderator_forum_ids( $user_id = 0 ) {
1060 1058 return bbp_get_user_object_ids(
1061 1059 array(
@@ -1067,15 +1065,15 @@
1067 1065 );
1068 1066 }
1069 1067
1070 1068 /**
1071 - * Get a user's engaged topic ids.
1069 + * Get a user's engaged topic ids
1072 1070 *
1073 1071 * @since 2.6.0 bbPress (r6311)
1074 1072 *
1075 - * @param int $user_id Optional. User id.
1073 + * @param int $user_id Optional. User id
1076 1074 *
1077 - * @return array Return array of topic ids, or empty array.
1075 + * @return array Return array of topic ids, or empty array
1078 1076 */
1079 1077 function bbp_get_user_engaged_topic_ids( $user_id = 0 ) {
1080 1078 return bbp_get_user_object_ids(
1081 1079 array(
@@ -1086,15 +1084,15 @@
1086 1084 );
1087 1085 }
1088 1086
1089 1087 /**
1090 - * Get a user's favorite topic ids.
1088 + * Get a user's favorite topic ids
1091 1089 *
1092 1090 * @since 2.0.0 bbPress (r2652)
1093 1091 *
1094 - * @param int $user_id Optional. User id.
1092 + * @param int $user_id Optional. User id
1095 1093 *
1096 - * @return array Return array of favorite topic ids, or empty array.
1094 + * @return array Return array of favorite topic ids, or empty array
1097 1095 */
1098 1096 function bbp_get_user_favorites_topic_ids( $user_id = 0 ) {
1099 1097 return bbp_get_user_object_ids(
1100 1098 array(
@@ -1105,15 +1103,15 @@
1105 1103 );
1106 1104 }
1107 1105
1108 1106 /**
1109 - * Get a user's subscribed forum ids.
1107 + * Get a user's subscribed forum ids
1110 1108 *
1111 1109 * @since 2.5.0 bbPress (r5156)
1112 1110 *
1113 - * @param int $user_id Optional. User id.
1111 + * @param int $user_id Optional. User id
1114 1112 *
1115 - * @return array Return array of subscribed forum ids, or empty array.
1113 + * @return array Return array of subscribed forum ids, or empty array
1116 1114 */
1117 1115 function bbp_get_user_subscribed_forum_ids( $user_id = 0 ) {
1118 1116 return bbp_get_user_object_ids(
1119 1117 array(
@@ -1125,15 +1123,15 @@
1125 1123 );
1126 1124 }
1127 1125
1128 1126 /**
1129 - * Get a user's subscribed topic ids.
1127 + * Get a user's subscribed topic ids
1130 1128 *
1131 1129 * @since 2.0.0 bbPress (r2668)
1132 1130 *
1133 - * @param int $user_id Optional. User id.
1131 + * @param int $user_id Optional. User id
1134 1132 *
1135 - * @return array Return array of subscribed topic ids, or empty array.
1133 + * @return array Return array of subscribed topic ids, or empty array
1136 1134 */
1137 1135 function bbp_get_user_subscribed_topic_ids( $user_id = 0 ) {
1138 1136 return bbp_get_user_object_ids(
1139 1137 array(
@@ -1146,16 +1144,16 @@
1146 1144
1147 1145 /** Deprecated ****************************************************************/
1148 1146
1149 1147 /**
1150 - * Get a user's subscribed topics.
1148 + * Get a user's subscribed topics
1151 1149 *
1152 1150 * @since 2.0.0 bbPress (r2668)
1153 1151 * @deprecated 2.5.0 bbPress (r5156)
1154 1152 *
1155 - * @param int $user_id Optional. User id.
1153 + * @param int $user_id Optional. User id
1156 1154 *
1157 - * @return array|bool Results if user has subscriptions, otherwise false.
1155 + * @return array|bool Results if user has subscriptions, otherwise false
1158 1156 */
1159 1157 function bbp_get_user_subscriptions( $user_id = 0 ) {
1160 1158 _deprecated_function( __FUNCTION__, '2.5', 'bbp_get_user_topic_subscriptions()' );
1161 1159 $query = bbp_get_user_topic_subscriptions( $user_id );
@@ -1164,16 +1162,16 @@
1164 1162 return apply_filters( 'bbp_get_user_subscriptions', $query, $user_id );
1165 1163 }
1166 1164
1167 1165 /**
1168 - * Get the users who have subscribed to the forum.
1166 + * Get the users who have subscribed to the forum
1169 1167 *
1170 1168 * @since 2.5.0 bbPress (r5156)
1171 1169 * @deprecated 2.6.0 bbPress (r6543)
1172 1170 *
1173 - * @param int $forum_id Optional. forum id.
1171 + * @param int $forum_id Optional. forum id
1174 1172 *
1175 - * @return array|bool Results if the forum has any subscribers, otherwise false.
1173 + * @return array|bool Results if the forum has any subscribers, otherwise false
1176 1174 */
1177 1175 function bbp_get_forum_subscribers( $forum_id = 0 ) {
1178 1176 $users = bbp_get_users_for_object( $forum_id, '_bbp_subscription' );
1179 1177
@@ -1181,16 +1179,16 @@
1181 1179 return (array) apply_filters( 'bbp_get_forum_subscribers', $users, $forum_id );
1182 1180 }
1183 1181
1184 1182 /**
1185 - * Get the users who have subscribed to the topic.
1183 + * Get the users who have subscribed to the topic
1186 1184 *
1187 1185 * @since 2.0.0 bbPress (r2668)
1188 1186 * @deprecated 2.6.0 bbPress (r6543)
1189 1187 *
1190 - * @param int $topic_id Optional. Topic id.
1188 + * @param int $topic_id Optional. Topic id
1191 1189 *
1192 - * @return array|bool Results if the topic has any subscribers, otherwise false.
1190 + * @return array|bool Results if the topic has any subscribers, otherwise false
1193 1191 */
1194 1192 function bbp_get_topic_subscribers( $topic_id = 0 ) {
1195 1193 $users = bbp_get_users_for_object( $topic_id, '_bbp_subscription' );
1196 1194
@@ -1198,17 +1196,17 @@
1198 1196 return (array) apply_filters( 'bbp_get_topic_subscribers', $users, $topic_id );
1199 1197 }
1200 1198
1201 1199 /**
1202 - * Check if a forum is in user's subscription list or not.
1200 + * Check if a forum is in user's subscription list or not
1203 1201 *
1204 1202 * @since 2.5.0 bbPress (r5156)
1205 1203 * @deprecated 2.6.0 bbPress (r6543)
1206 1204 *
1207 - * @param int $user_id Optional. User id.
1208 - * @param int $forum_id Optional. Forum id.
1205 + * @param int $user_id Optional. User id
1206 + * @param int $forum_id Optional. Forum id
1209 1207 *
1210 - * @return bool True if the forum is in user's subscriptions, otherwise false.
1208 + * @return bool True if the forum is in user's subscriptions, otherwise false
1211 1209 */
1212 1210 function bbp_is_user_subscribed_to_forum( $user_id = 0, $forum_id = 0 ) {
1213 1211 return bbp_is_user_subscribed( $user_id, $forum_id );
1214 1212 }
@@ -1213,16 +1211,16 @@
1213 1211 return bbp_is_user_subscribed( $user_id, $forum_id );
1214 1212 }
1215 1213
1216 1214 /**
1217 - * Check if a topic is in user's subscription list or not.
1215 + * Check if a topic is in user's subscription list or not
1218 1216 *
1219 1217 * @since 2.5.0 bbPress (r5156)
1220 1218 * @deprecated 2.6.0 bbPress (r6543) Use bbp_is_user_subscribed()
1221 1219 *
1222 - * @param int $user_id Optional. User id.
1223 - * @param int $topic_id Optional. Topic id.
1224 - * @return bool True if the topic is in user's subscriptions, otherwise false.
1220 + * @param int $user_id Optional. User id
1221 + * @param int $topic_id Optional. Topic id
1222 + * @return bool True if the topic is in user's subscriptions, otherwise false
1225 1223 */
1226 1224 function bbp_is_user_subscribed_to_topic( $user_id = 0, $topic_id = 0 ) {
1227 1225 return bbp_is_user_subscribed( $user_id, $topic_id );
1228 1226 }
@@ -1227,17 +1225,17 @@
1227 1225 return bbp_is_user_subscribed( $user_id, $topic_id );
1228 1226 }
1229 1227
1230 1228 /**
1231 - * Remove a forum from user's subscriptions.
1229 + * Remove a forum from user's subscriptions
1232 1230 *
1233 1231 * @since 2.5.0 bbPress (r5156)
1234 1232 * @deprecated 2.6.0 bbPress (r6543)
1235 1233 *
1236 - * @param int $user_id Optional. User id.
1237 - * @param int $forum_id Optional. forum id.
1234 + * @param int $user_id Optional. User id
1235 + * @param int $forum_id Optional. forum id
1238 1236 * @return bool True if the forum was removed from user's subscriptions,
1239 - * otherwise false.
1237 + * otherwise false
1240 1238 */
1241 1239 function bbp_remove_user_forum_subscription( $user_id = 0, $forum_id = 0 ) {
1242 1240 return bbp_remove_user_subscription( $user_id, $forum_id );
1243 1241 }
@@ -1242,17 +1240,17 @@
1242 1240 return bbp_remove_user_subscription( $user_id, $forum_id );
1243 1241 }
1244 1242
1245 1243 /**
1246 - * Remove a topic from user's subscriptions.
1244 + * Remove a topic from user's subscriptions
1247 1245 *
1248 1246 * @since 2.5.0 bbPress (r5156)
1249 1247 * @deprecated 2.6.0 bbPress (r6543)
1250 1248 *
1251 - * @param int $user_id Optional. User id.
1252 - * @param int $topic_id Optional. Topic id.
1249 + * @param int $user_id Optional. User id
1250 + * @param int $topic_id Optional. Topic id
1253 1251 * @return bool True if the topic was removed from user's subscriptions,
1254 - * otherwise false.
1252 + * otherwise false
1255 1253 */
1256 1254 function bbp_remove_user_topic_subscription( $user_id = 0, $topic_id = 0 ) {
1257 1255 return bbp_remove_user_subscription( $user_id, $topic_id );
1258 1256 }
@@ -1257,16 +1255,16 @@
1257 1255 return bbp_remove_user_subscription( $user_id, $topic_id );
1258 1256 }
1259 1257
1260 1258 /**
1261 - * Add a forum to user's subscriptions.
1259 + * Add a forum to user's subscriptions
1262 1260 *
1263 1261 * @since 2.5.0 bbPress (r5156)
1264 1262 * @deprecated 2.6.0 bbPress (r6543)
1265 1263 *
1266 - * @param int $user_id Optional. User id.
1267 - * @param int $forum_id Optional. forum id.
1268 - * @return bool Always true.
1264 + * @param int $user_id Optional. User id
1265 + * @param int $forum_id Optional. forum id
1266 + * @return bool Always true
1269 1267 */
1270 1268 function bbp_add_user_forum_subscription( $user_id = 0, $forum_id = 0 ) {
1271 1269 return bbp_add_user_subscription( $user_id, $forum_id );
1272 1270 }
@@ -1271,9 +1269,9 @@
1271 1269 return bbp_add_user_subscription( $user_id, $forum_id );
1272 1270 }
1273 1271
1274 1272 /**
1275 - * Add a topic to user's subscriptions.
1273 + * Add a topic to user's subscriptions
1276 1274 *
1277 1275 * Note that both the User and Topic should be verified to exist before using
1278 1276 * this function. Originally both were validated, but because this function is
1279 1277 * frequently used within a loop, those verifications were moved upstream to
@@ -1281,11 +1279,11 @@
1281 1279 *
1282 1280 * @since 2.5.0 bbPress (r5156)
1283 1281 * @deprecated 2.6.0 bbPress (r6543)
1284 1282 *
1285 - * @param int $user_id Optional. User id.
1286 - * @param int $topic_id Optional. Topic id.
1287 - * @return bool Always true.
1283 + * @param int $user_id Optional. User id
1284 + * @param int $topic_id Optional. Topic id
1285 + * @return bool Always true
1288 1286 */
1289 1287 function bbp_add_user_topic_subscription( $user_id = 0, $topic_id = 0 ) {
1290 1288 return bbp_add_user_subscription( $user_id, $topic_id );
1291 1289 }
@@ -1290,9 +1288,9 @@
1290 1288 return bbp_add_user_subscription( $user_id, $topic_id );
1291 1289 }
1292 1290
1293 1291 /**
1294 - * Handles the front end toggling of forum subscriptions.
1292 + * Handles the front end toggling of forum subscriptions
1295 1293 *
1296 1294 * @since 2.5.0 bbPress (r5156)
1297 1295 * @deprecated 2.6.0 bbPress (r6543)
1298 1296 */