PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
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 2.2 2.2.1 All 72 releases
← All changes | includes/users/engagements.php +163 -165 trunk2.6.17 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 (r6109)
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 (r6109)
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 (r6109)
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 (r6747)
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 (r6320)
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,9 +188,9 @@
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)
@@ -195,9 +195,9 @@
195 195 *
196 196 * @since 2.6.0 bbPress (r6522)
197 197 * @since 2.6.17 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 (r6320)
245 245 * @since 2.6.0 bbPress (r6618) 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 (r6320)
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 (r6320)
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 (r6320)
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 (r6526)
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
@@ -450,15 +450,15 @@
450 450
451 451 /** Favorites *****************************************************************/
452 452
453 453 /**
454 - * Get the users who have made the topic favorite.
454 + * Get the users who have made the topic favorite
455 455 *
456 456 * @since 2.0.0 bbPress (r2658)
457 457 *
458 - * @param int $topic_id Optional. Topic id.
458 + * @param int $topic_id Optional. Topic id
459 459 *
460 - * @return array|bool Results if the topic has any favoriters, otherwise false.
460 + * @return array|bool Results if the topic has any favoriters, otherwise false
461 461 */
462 462 function bbp_get_topic_favoriters( $topic_id = 0 ) {
463 463 $topic_id = bbp_get_topic_id( $topic_id );
464 464 $users = bbp_get_users_for_object( $topic_id, '_bbp_favorite' );
@@ -467,16 +467,16 @@
467 467 return (array) apply_filters( 'bbp_get_topic_favoriters', $users, $topic_id );
468 468 }
469 469
470 470 /**
471 - * Get a user's favorite topics.
471 + * Get a user's favorite topics
472 472 *
473 473 * @since 2.0.0 bbPress (r2652)
474 474 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments
475 475 *
476 - * @param array $args Optional. Arguments to pass into bbp_has_topics().
476 + * @param array $args Optional. Arguments to pass into bbp_has_topics()
477 477 *
478 - * @return array Array of topics if user has favorites, otherwise empty array.
478 + * @return array Array of topics if user has favorites, otherwise empty array
479 479 */
480 480 function bbp_get_user_favorites( $args = array() ) {
481 481 $r = bbp_get_user_object_query( $args, 'favorites', '_bbp_favorite' );
482 482 $query = ! empty( $r )
@@ -487,16 +487,16 @@
487 487 return apply_filters( 'bbp_get_user_favorites', $query, 0, $r, $args );
488 488 }
489 489
490 490 /**
491 - * Check if a topic is in user's favorites or not.
491 + * Check if a topic is in user's favorites or not
492 492 *
493 493 * @since 2.0.0 bbPress (r2652)
494 494 *
495 - * @param int $user_id Optional. User id.
496 - * @param int $topic_id Optional. Topic id.
495 + * @param int $user_id Optional. User id
496 + * @param int $topic_id Optional. Topic id
497 497 *
498 - * @return bool True if the topic is in user's favorites, otherwise false.
498 + * @return bool True if the topic is in user's favorites, otherwise false
499 499 */
500 500 function bbp_is_user_favorite( $user_id = 0, $topic_id = 0 ) {
501 501 $retval = bbp_is_object_of_user( $topic_id, $user_id, '_bbp_favorite' );
502 502
@@ -504,9 +504,9 @@
504 504 return (bool) apply_filters( 'bbp_is_user_favorite', $retval, $user_id, $topic_id );
505 505 }
506 506
507 507 /**
508 - * Add a topic to user's favorites.
508 + * Add a topic to user's favorites
509 509 *
510 510 * Note that both the User and Topic should be verified to exist before using
511 511 * this function. Originally both were validated, but because this function is
512 512 * frequently used within a loop, those verifications were moved upstream to
@@ -513,12 +513,12 @@
513 513 * improve performance on topics with many engaged users.
514 514 *
515 515 * @since 2.0.0 bbPress (r2652)
516 516 *
517 - * @param int $user_id Optional. User id.
518 - * @param int $topic_id Optional. Topic id.
517 + * @param int $user_id Optional. User id
518 + * @param int $topic_id Optional. Topic id
519 519 *
520 - * @return bool True if the topic was added to user's favorites, otherwise false.
520 + * @return bool True if the topic was added to user's favorites, otherwise false
521 521 */
522 522 function bbp_add_user_favorite( $user_id = 0, $topic_id = 0 ) {
523 523 $user_id = bbp_get_user_id( $user_id, false, false );
524 524 $topic_id = bbp_get_topic_id( $topic_id );
@@ -543,16 +543,16 @@
543 543 return true;
544 544 }
545 545
546 546 /**
547 - * Remove a topic from user's favorites.
547 + * Remove a topic from user's favorites
548 548 *
549 549 * @since 2.0.0 bbPress (r2652)
550 550 *
551 - * @param int $user_id Optional. User id.
552 - * @param int $topic_id Optional. Topic id.
551 + * @param int $user_id Optional. User id
552 + * @param int $topic_id Optional. Topic id
553 553 *
554 - * @return bool True if the topic was removed from user's favorites, otherwise false.
554 + * @return bool True if the topic was removed from user's favorites, otherwise false
555 555 */
556 556 function bbp_remove_user_favorite( $user_id, $topic_id ) {
557 557 $user_id = bbp_get_user_id( $user_id, false, false );
558 558 $topic_id = bbp_get_topic_id( $topic_id );
@@ -577,13 +577,11 @@
577 577 return true;
578 578 }
579 579
580 580 /**
581 - * Handles the front end adding and removing of favorite topics.
581 + * Handles the front end adding and removing of favorite topics
582 582 *
583 - * @since 2.0.0 bbPress (r2652)
584 - *
585 - * @param string $action The requested action to compare this function to.
583 + * @param string $action The requested action to compare this function to
586 584 */
587 585 function bbp_favorites_handler( $action = '' ) {
588 586
589 587 // Default
@@ -675,13 +673,13 @@
675 673
676 674 /** Subscriptions *************************************************************/
677 675
678 676 /**
679 - * Get the users who have subscribed.
677 + * Get the users who have subscribed
680 678 *
681 679 * @since 2.6.0 bbPress (r5156)
682 680 *
683 - * @param int $object_id Optional. ID of object (forum, topic, or something else).
681 + * @param int $object_id Optional. ID of object (forum, topic, or something else)
684 682 */
685 683 function bbp_get_subscribers( $object_id = 0, $type = 'post' ) {
686 684 $users = bbp_get_users_for_object( $object_id, '_bbp_subscription', $type );
687 685
@@ -689,16 +687,16 @@
689 687 return (array) apply_filters( 'bbp_get_subscribers', $users, $object_id, $type );
690 688 }
691 689
692 690 /**
693 - * Get a user's subscribed topics.
691 + * Get a user's subscribed topics
694 692 *
695 693 * @since 2.0.0 bbPress (r2668)
696 694 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments
697 695 *
698 - * @param array $args Optional. Arguments to pass into bbp_has_topics().
696 + * @param array $args Optional. Arguments to pass into bbp_has_topics()
699 697 *
700 - * @return array Array of topics if user has topic subscriptions, otherwise empty array.
698 + * @return array Array of topics if user has topic subscriptions, otherwise empty array
701 699 */
702 700 function bbp_get_user_topic_subscriptions( $args = array() ) {
703 701 $r = bbp_get_user_object_query( $args, 'topic_subscriptions', '_bbp_subscription' );
704 702 $query = ! empty( $r )
@@ -709,16 +707,16 @@
709 707 return apply_filters( 'bbp_get_user_topic_subscriptions', $query, 0, $r, $args );
710 708 }
711 709
712 710 /**
713 - * Get a user's subscribed forums.
711 + * Get a user's subscribed forums
714 712 *
715 713 * @since 2.5.0 bbPress (r5156)
716 714 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments
717 715 *
718 - * @param array $args Optional. Arguments to pass into bbp_has_forums().
716 + * @param array $args Optional. Arguments to pass into bbp_has_forums()
719 717 *
720 - * @return array Array of forums if user has forum subscriptions, otherwise empty array.
718 + * @return array Array of forums if user has forum subscriptions, otherwise empty array
721 719 */
722 720 function bbp_get_user_forum_subscriptions( $args = array() ) {
723 721 $r = bbp_get_user_object_query( $args, 'forum_subscriptions', '_bbp_subscription' );
724 722 $query = ! empty( $r )
@@ -729,16 +727,16 @@
729 727 return apply_filters( 'bbp_get_user_forum_subscriptions', $query, 0, $r, $args );
730 728 }
731 729
732 730 /**
733 - * Check if an object (forum or topic) is in user's subscription list or not.
731 + * Check if an object (forum or topic) is in user's subscription list or not
734 732 *
735 733 * @since 2.5.0 bbPress (r5156)
736 734 *
737 - * @param int $user_id Optional. User id.
738 - * @param int $object_id Optional. Object id.
735 + * @param int $user_id Optional. User id
736 + * @param int $object_id Optional. Object id
739 737 *
740 - * @return bool True if the object (forum or topic) is in user's subscriptions, otherwise false.
738 + * @return bool True if the object (forum or topic) is in user's subscriptions, otherwise false
741 739 */
742 740 function bbp_is_user_subscribed( $user_id = 0, $object_id = 0, $type = 'post' ) {
743 741 $retval = bbp_is_object_of_user( $object_id, $user_id, '_bbp_subscription', $type );
744 742
@@ -746,18 +744,18 @@
746 744 return (bool) apply_filters( 'bbp_is_user_subscribed', $retval, $user_id, $object_id, $type );
747 745 }
748 746
749 747 /**
750 - * Add a user subscription.
748 + * Add a user subscription
751 749 *
752 750 * @since 2.5.0 bbPress (r5156)
753 751 * @since 2.6.0 bbPress (r6544) Added $type parameter
754 752 *
755 - * @param int $user_id Optional. User id.
756 - * @param int $object_id Optional. Object id.
757 - * @param string $type Optional. Type of object being subscribed to.
753 + * @param int $user_id Optional. User id
754 + * @param int $object_id Optional. Object id
755 + * @param string $type Optional. Type of object being subscribed to
758 756 *
759 - * @return bool True if the object was added to user subscriptions, otherwise false.
757 + * @return bool True if the object was added to user subscriptions, otherwise false
760 758 */
761 759 function bbp_add_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' ) {
762 760
763 761 // Bail if not enough info
@@ -780,18 +778,18 @@
780 778 return true;
781 779 }
782 780
783 781 /**
784 - * Remove a user subscription.
782 + * Remove a user subscription
785 783 *
786 784 * @since 2.5.0 bbPress (r5156)
787 785 * @since 2.6.0 bbPress (r6544) Added $type parameter
788 786 *
789 - * @param int $user_id Optional. User id.
790 - * @param int $object_id Optional. Object id.
791 - * @param string $type Optional. Type of object being subscribed to.
787 + * @param int $user_id Optional. User id
788 + * @param int $object_id Optional. Object id
789 + * @param string $type Optional. Type of object being subscribed to
792 790 *
793 - * @return bool True if the object was removed from user subscriptions, otherwise false.
791 + * @return bool True if the object was removed from user subscriptions, otherwise false
794 792 */
795 793 function bbp_remove_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' ) {
796 794
797 795 // Bail if not enough info
@@ -814,14 +812,14 @@
814 812 return true;
815 813 }
816 814
817 815 /**
818 - * Handles the front end toggling of user subscriptions.
816 + * Handles the front end toggling of user subscriptions
819 817 *
820 818 * @since 2.0.0 bbPress (r2790)
821 819 * @since 2.6.l bbPress (r6543)
822 820 *
823 - * @param string $action The requested action to compare this function to.
821 + * @param string $action The requested action to compare this function to
824 822 */
825 823 function bbp_subscriptions_handler( $action = '' ) {
826 824
827 825 // Default
@@ -933,14 +931,14 @@
933 931 * parameters available inside of the various query APIs.
934 932 *
935 933 * @since 2.6.0 bbPress (r6606)
936 934 *
937 - * @param int $user_id The user id.
938 - * @param string $rel_key The relationship key.
939 - * @param string $rel_type The relationship type (usually 'post').
940 - * @param array $args The arguments to override defaults.
935 + * @param int $user_id The user id
936 + * @param string $rel_key The relationship key
937 + * @param string $rel_type The relationship type (usually 'post')
938 + * @param array $args The arguments to override defaults
941 939 *
942 - * @return array|bool Results if user has objects, otherwise null.
940 + * @return array|bool Results if user has objects, otherwise null
943 941 */
944 942 function bbp_get_user_object_ids( $args = array() ) {
945 943 $object_ids = $defaults = array();
946 944
@@ -1001,15 +999,15 @@
1001 999 return (array) apply_filters( "bbp_get_{$r['filter']}", $object_ids, $r, $args );
1002 1000 }
1003 1001
1004 1002 /**
1005 - * Get array of forum IDs that a user can moderate.
1003 + * Get array of forum IDs that a user can moderate
1006 1004 *
1007 1005 * @since 2.6.0 bbPress (r5834)
1008 1006 *
1009 1007 * @param int $user_id User id.
1010 1008 *
1011 - * @return array Return array of forum ids, or empty array.
1009 + * @return array Return array of forum ids, or empty array
1012 1010 */
1013 1011 function bbp_get_moderator_forum_ids( $user_id = 0 ) {
1014 1012 return bbp_get_user_object_ids(
1015 1013 array(
@@ -1021,15 +1019,15 @@
1021 1019 );
1022 1020 }
1023 1021
1024 1022 /**
1025 - * Get a user's engaged topic ids.
1023 + * Get a user's engaged topic ids
1026 1024 *
1027 1025 * @since 2.6.0 bbPress (r6320)
1028 1026 *
1029 - * @param int $user_id Optional. User id.
1027 + * @param int $user_id Optional. User id
1030 1028 *
1031 - * @return array Return array of topic ids, or empty array.
1029 + * @return array Return array of topic ids, or empty array
1032 1030 */
1033 1031 function bbp_get_user_engaged_topic_ids( $user_id = 0 ) {
1034 1032 return bbp_get_user_object_ids(
1035 1033 array(
@@ -1040,15 +1038,15 @@
1040 1038 );
1041 1039 }
1042 1040
1043 1041 /**
1044 - * Get a user's favorite topic ids.
1042 + * Get a user's favorite topic ids
1045 1043 *
1046 1044 * @since 2.0.0 bbPress (r2652)
1047 1045 *
1048 - * @param int $user_id Optional. User id.
1046 + * @param int $user_id Optional. User id
1049 1047 *
1050 - * @return array Return array of favorite topic ids, or empty array.
1048 + * @return array Return array of favorite topic ids, or empty array
1051 1049 */
1052 1050 function bbp_get_user_favorites_topic_ids( $user_id = 0 ) {
1053 1051 return bbp_get_user_object_ids(
1054 1052 array(
@@ -1059,15 +1057,15 @@
1059 1057 );
1060 1058 }
1061 1059
1062 1060 /**
1063 - * Get a user's subscribed forum ids.
1061 + * Get a user's subscribed forum ids
1064 1062 *
1065 1063 * @since 2.5.0 bbPress (r5156)
1066 1064 *
1067 - * @param int $user_id Optional. User id.
1065 + * @param int $user_id Optional. User id
1068 1066 *
1069 - * @return array Return array of subscribed forum ids, or empty array.
1067 + * @return array Return array of subscribed forum ids, or empty array
1070 1068 */
1071 1069 function bbp_get_user_subscribed_forum_ids( $user_id = 0 ) {
1072 1070 return bbp_get_user_object_ids(
1073 1071 array(
@@ -1079,15 +1077,15 @@
1079 1077 );
1080 1078 }
1081 1079
1082 1080 /**
1083 - * Get a user's subscribed topic ids.
1081 + * Get a user's subscribed topic ids
1084 1082 *
1085 1083 * @since 2.0.0 bbPress (r2668)
1086 1084 *
1087 - * @param int $user_id Optional. User id.
1085 + * @param int $user_id Optional. User id
1088 1086 *
1089 - * @return array Return array of subscribed topic ids, or empty array.
1087 + * @return array Return array of subscribed topic ids, or empty array
1090 1088 */
1091 1089 function bbp_get_user_subscribed_topic_ids( $user_id = 0 ) {
1092 1090 return bbp_get_user_object_ids(
1093 1091 array(
@@ -1100,16 +1098,16 @@
1100 1098
1101 1099 /** Deprecated ****************************************************************/
1102 1100
1103 1101 /**
1104 - * Get a user's subscribed topics.
1102 + * Get a user's subscribed topics
1105 1103 *
1106 1104 * @since 2.0.0 bbPress (r2668)
1107 1105 * @deprecated 2.5.0 bbPress (r5156)
1108 1106 *
1109 - * @param int $user_id Optional. User id.
1107 + * @param int $user_id Optional. User id
1110 1108 *
1111 - * @return array|bool Results if user has subscriptions, otherwise false.
1109 + * @return array|bool Results if user has subscriptions, otherwise false
1112 1110 */
1113 1111 function bbp_get_user_subscriptions( $user_id = 0 ) {
1114 1112 _deprecated_function( __FUNCTION__, '2.5', 'bbp_get_user_topic_subscriptions()' );
1115 1113 $query = bbp_get_user_topic_subscriptions( $user_id );
@@ -1118,16 +1116,16 @@
1118 1116 return apply_filters( 'bbp_get_user_subscriptions', $query, $user_id );
1119 1117 }
1120 1118
1121 1119 /**
1122 - * Get the users who have subscribed to the forum.
1120 + * Get the users who have subscribed to the forum
1123 1121 *
1124 1122 * @since 2.5.0 bbPress (r5156)
1125 1123 * @deprecated 2.6.0 bbPress (r6543)
1126 1124 *
1127 - * @param int $forum_id Optional. forum id.
1125 + * @param int $forum_id Optional. forum id
1128 1126 *
1129 - * @return array|bool Results if the forum has any subscribers, otherwise false.
1127 + * @return array|bool Results if the forum has any subscribers, otherwise false
1130 1128 */
1131 1129 function bbp_get_forum_subscribers( $forum_id = 0 ) {
1132 1130 $users = bbp_get_users_for_object( $forum_id, '_bbp_subscription' );
1133 1131
@@ -1135,16 +1133,16 @@
1135 1133 return (array) apply_filters( 'bbp_get_forum_subscribers', $users, $forum_id );
1136 1134 }
1137 1135
1138 1136 /**
1139 - * Get the users who have subscribed to the topic.
1137 + * Get the users who have subscribed to the topic
1140 1138 *
1141 1139 * @since 2.0.0 bbPress (r2668)
1142 1140 * @deprecated 2.6.0 bbPress (r6543)
1143 1141 *
1144 - * @param int $topic_id Optional. Topic id.
1142 + * @param int $topic_id Optional. Topic id
1145 1143 *
1146 - * @return array|bool Results if the topic has any subscribers, otherwise false.
1144 + * @return array|bool Results if the topic has any subscribers, otherwise false
1147 1145 */
1148 1146 function bbp_get_topic_subscribers( $topic_id = 0 ) {
1149 1147 $users = bbp_get_users_for_object( $topic_id, '_bbp_subscription' );
1150 1148
@@ -1152,17 +1150,17 @@
1152 1150 return (array) apply_filters( 'bbp_get_topic_subscribers', $users, $topic_id );
1153 1151 }
1154 1152
1155 1153 /**
1156 - * Check if a forum is in user's subscription list or not.
1154 + * Check if a forum is in user's subscription list or not
1157 1155 *
1158 1156 * @since 2.5.0 bbPress (r5156)
1159 1157 * @deprecated 2.6.0 bbPress (r6543)
1160 1158 *
1161 - * @param int $user_id Optional. User id.
1162 - * @param int $forum_id Optional. Forum id.
1159 + * @param int $user_id Optional. User id
1160 + * @param int $forum_id Optional. Forum id
1163 1161 *
1164 - * @return bool True if the forum is in user's subscriptions, otherwise false.
1162 + * @return bool True if the forum is in user's subscriptions, otherwise false
1165 1163 */
1166 1164 function bbp_is_user_subscribed_to_forum( $user_id = 0, $forum_id = 0 ) {
1167 1165 return bbp_is_user_subscribed( $user_id, $forum_id );
1168 1166 }
@@ -1167,16 +1165,16 @@
1167 1165 return bbp_is_user_subscribed( $user_id, $forum_id );
1168 1166 }
1169 1167
1170 1168 /**
1171 - * Check if a topic is in user's subscription list or not.
1169 + * Check if a topic is in user's subscription list or not
1172 1170 *
1173 1171 * @since 2.5.0 bbPress (r5156)
1174 1172 * @deprecated 2.6.0 bbPress (r6543) Use bbp_is_user_subscribed()
1175 1173 *
1176 - * @param int $user_id Optional. User id.
1177 - * @param int $topic_id Optional. Topic id.
1178 - * @return bool True if the topic is in user's subscriptions, otherwise false.
1174 + * @param int $user_id Optional. User id
1175 + * @param int $topic_id Optional. Topic id
1176 + * @return bool True if the topic is in user's subscriptions, otherwise false
1179 1177 */
1180 1178 function bbp_is_user_subscribed_to_topic( $user_id = 0, $topic_id = 0 ) {
1181 1179 return bbp_is_user_subscribed( $user_id, $topic_id );
1182 1180 }
@@ -1181,17 +1179,17 @@
1181 1179 return bbp_is_user_subscribed( $user_id, $topic_id );
1182 1180 }
1183 1181
1184 1182 /**
1185 - * Remove a forum from user's subscriptions.
1183 + * Remove a forum from user's subscriptions
1186 1184 *
1187 1185 * @since 2.5.0 bbPress (r5156)
1188 1186 * @deprecated 2.6.0 bbPress (r6543)
1189 1187 *
1190 - * @param int $user_id Optional. User id.
1191 - * @param int $forum_id Optional. forum id.
1188 + * @param int $user_id Optional. User id
1189 + * @param int $forum_id Optional. forum id
1192 1190 * @return bool True if the forum was removed from user's subscriptions,
1193 - * otherwise false.
1191 + * otherwise false
1194 1192 */
1195 1193 function bbp_remove_user_forum_subscription( $user_id = 0, $forum_id = 0 ) {
1196 1194 return bbp_remove_user_subscription( $user_id, $forum_id );
1197 1195 }
@@ -1196,17 +1194,17 @@
1196 1194 return bbp_remove_user_subscription( $user_id, $forum_id );
1197 1195 }
1198 1196
1199 1197 /**
1200 - * Remove a topic from user's subscriptions.
1198 + * Remove a topic from user's subscriptions
1201 1199 *
1202 1200 * @since 2.5.0 bbPress (r5156)
1203 1201 * @deprecated 2.6.0 bbPress (r6543)
1204 1202 *
1205 - * @param int $user_id Optional. User id.
1206 - * @param int $topic_id Optional. Topic id.
1203 + * @param int $user_id Optional. User id
1204 + * @param int $topic_id Optional. Topic id
1207 1205 * @return bool True if the topic was removed from user's subscriptions,
1208 - * otherwise false.
1206 + * otherwise false
1209 1207 */
1210 1208 function bbp_remove_user_topic_subscription( $user_id = 0, $topic_id = 0 ) {
1211 1209 return bbp_remove_user_subscription( $user_id, $topic_id );
1212 1210 }
@@ -1211,16 +1209,16 @@
1211 1209 return bbp_remove_user_subscription( $user_id, $topic_id );
1212 1210 }
1213 1211
1214 1212 /**
1215 - * Add a forum to user's subscriptions.
1213 + * Add a forum to user's subscriptions
1216 1214 *
1217 1215 * @since 2.5.0 bbPress (r5156)
1218 1216 * @deprecated 2.6.0 bbPress (r6543)
1219 1217 *
1220 - * @param int $user_id Optional. User id.
1221 - * @param int $forum_id Optional. forum id.
1222 - * @return bool Always true.
1218 + * @param int $user_id Optional. User id
1219 + * @param int $forum_id Optional. forum id
1220 + * @return bool Always true
1223 1221 */
1224 1222 function bbp_add_user_forum_subscription( $user_id = 0, $forum_id = 0 ) {
1225 1223 return bbp_add_user_subscription( $user_id, $forum_id );
1226 1224 }
@@ -1225,9 +1223,9 @@
1225 1223 return bbp_add_user_subscription( $user_id, $forum_id );
1226 1224 }
1227 1225
1228 1226 /**
1229 - * Add a topic to user's subscriptions.
1227 + * Add a topic to user's subscriptions
1230 1228 *
1231 1229 * Note that both the User and Topic should be verified to exist before using
1232 1230 * this function. Originally both were validated, but because this function is
1233 1231 * frequently used within a loop, those verifications were moved upstream to
@@ -1235,11 +1233,11 @@
1235 1233 *
1236 1234 * @since 2.0.0 bbPress (r2668)
1237 1235 * @deprecated 2.6.0 bbPress (r6543)
1238 1236 *
1239 - * @param int $user_id Optional. User id.
1240 - * @param int $topic_id Optional. Topic id.
1241 - * @return bool Always true.
1237 + * @param int $user_id Optional. User id
1238 + * @param int $topic_id Optional. Topic id
1239 + * @return bool Always true
1242 1240 */
1243 1241 function bbp_add_user_topic_subscription( $user_id = 0, $topic_id = 0 ) {
1244 1242 return bbp_add_user_subscription( $user_id, $topic_id );
1245 1243 }
@@ -1244,9 +1242,9 @@
1244 1242 return bbp_add_user_subscription( $user_id, $topic_id );
1245 1243 }
1246 1244
1247 1245 /**
1248 - * Handles the front end toggling of forum subscriptions.
1246 + * Handles the front end toggling of forum subscriptions
1249 1247 *
1250 1248 * @since 2.5.0 bbPress (r5156)
1251 1249 * @deprecated 2.6.0 bbPress (r6543)
1252 1250 */