PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
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/extend/buddypress/groups.php +130 -189 trunk → 2.6.17 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 /**
4 - * bbPress BuddyPress Group Extension Class.
4 + * bbPress BuddyPress Group Extension Class
5 5 *
6 6 * This file is responsible for connecting bbPress to the BuddyPress Groups
7 7 * Component. It's a great example of how to perform both simple and advanced
8 8 * techniques to manipulate the default output provided by both.
@@ -15,9 +15,9 @@
15 15 defined( 'ABSPATH' ) || exit;
16 16
17 17 if ( ! class_exists( 'BBP_Forums_Group_Extension' ) && class_exists( 'BP_Group_Extension' ) ) :
18 18 /**
19 - * Loads Group Extension for Forums Component.
19 + * Loads Group Extension for Forums Component
20 20 *
21 21 * @since 2.1.0 bbPress (r3552)
22 22 *
23 23 * @package bbPress
@@ -27,9 +27,9 @@
27 27
28 28 /** Methods ***************************************************************/
29 29
30 30 /**
31 - * Setup bbPress group extension variables.
31 + * Setup bbPress group extension variables
32 32 *
33 33 * @since 2.1.0 bbPress (r3552)
34 34 */
35 35 public function __construct() {
@@ -40,11 +40,11 @@
40 40 $this->fully_loaded();
41 41 }
42 42
43 43 /**
44 - * Setup the group forums class variables.
44 + * Setup the group forums class variables
45 45 *
46 - * @since 2.3.0 bbPress (r4553)
46 + * @since 2.1.0 bbPress (r3552)
47 47 */
48 48 private function setup_variables() {
49 49
50 50 // Component Name
@@ -73,11 +73,11 @@
73 73 $this->display_hook = 'bp_template_content';
74 74 }
75 75
76 76 /**
77 - * Setup the group forums class actions.
77 + * Setup the group forums class actions
78 78 *
79 - * @since 2.3.0 bbPress (r4553)
79 + * @since 2.3.0 bbPress (r4552)
80 80 */
81 81 private function setup_actions() {
82 82
83 83 // Possibly redirect
@@ -106,11 +106,11 @@
106 106 add_action( 'bp_before_group_settings_admin', array( $this, 'group_settings_hidden_field' ) );
107 107 }
108 108
109 109 /**
110 - * Setup the group forums class filters.
110 + * Setup the group forums class filters
111 111 *
112 - * @since 2.3.0 bbPress (r4553)
112 + * @since 2.3.0 bbPress (r4552)
113 113 */
114 114 private function setup_filters() {
115 115
116 116 // Group forum pagination
@@ -167,9 +167,9 @@
167 167
168 168 /**
169 169 * Check whether a user can view a private or hidden group forum.
170 170 *
171 - * @since 2.7.0 bbPress (r7495)
171 + * @since 2.6.17
172 172 *
173 173 * @param int $user_id User ID.
174 174 * @param int $forum_id Forum ID.
175 175 * @return bool|null Whether the user can view the group forum, or null when
@@ -202,9 +202,9 @@
202 202
203 203 /**
204 204 * Map read access for private and hidden group forums in every request.
205 205 *
206 - * @since 2.7.0 bbPress (r7495)
206 + * @since 2.6.17
207 207 *
208 208 * @param array $caps Capabilities for the meta capability.
209 209 * @param string $cap Capability name.
210 210 * @param int $user_id User ID.
@@ -235,10 +235,9 @@
235 235
236 236 /**
237 237 * Exclude private and hidden group forums a user cannot view.
238 238 *
239 - * @since 2.7.0 bbPress (r7495)
240 - * @since 2.6.19 bbPress (r7677) Exclude unreadable descendants.
239 + * @since 2.6.17
241 240 *
242 241 * @param array $forum_ids Forum IDs already excluded.
243 242 * @return array Forum IDs the user cannot view.
244 243 */
@@ -253,36 +252,9 @@
253 252 continue;
254 253 }
255 254
256 255 if ( ! user_can( $user_id, 'read_forum', $forum_id ) ) {
257 - // Exclude descendants too, except those this user can read.
258 - $parents = array( $forum_id );
259 - $seen = array( $forum_id => true );
260 - $readable = array();
261 256 $forum_ids[] = $forum_id;
262 -
263 - while ( ! empty( $parents ) ) {
264 - $parent_id = array_shift( $parents );
265 -
266 - foreach ( bbp_forum_query_all_subforum_ids( $parent_id ) as $child_id ) {
267 - $child_id = (int) $child_id;
268 -
269 - if ( isset( $seen[ $child_id ] ) ) {
270 - continue;
271 - }
272 -
273 - $seen[ $child_id ] = true;
274 - $parents[] = $child_id;
275 -
276 - if ( user_can( $user_id, 'read_forum', $child_id ) ) {
277 - $readable[] = $child_id;
278 - } else {
279 - $forum_ids[] = $child_id;
280 - }
281 - }
282 - }
283 -
284 - $forum_ids = array_diff( $forum_ids, $readable );
285 257 continue;
286 258 }
287 259
288 260 // Include readable descendants that inherited this restriction
@@ -308,9 +280,9 @@
308 280 *
309 281 * Unlike the request-specific capability mapping, this check accepts an
310 282 * explicit user ID so it can validate subscription recipients.
311 283 *
312 - * @since 2.6.17 bbPress (r7493)
284 + * @since 2.6.17
313 285 *
314 286 * @param bool $retval Whether the user can view the forum.
315 287 * @param int $user_id User ID.
316 288 * @param int $forum_id Forum ID.
@@ -336,9 +308,9 @@
336 308 * Ensure that bbp_is_single_forum() returns true on group forum pages.
337 309 *
338 310 * @see https://bbpress.trac.wordpress.org/ticket/2974
339 311 *
340 - * @since 2.6.0 bbPress (r6367)
312 + * @since 2.6.0 bbPress (r6366)
341 313 *
342 314 * @param bool $retval Current boolean.
343 315 * @return bool
344 316 */
@@ -372,11 +344,11 @@
372 344 return $retval;
373 345 }
374 346
375 347 /**
376 - * The primary display function for group forums.
348 + * The primary display function for group forums
377 349 *
378 - * @since 2.1.0 bbPress (r3552)
350 + * @since 2.1.0 bbPress (r3746)
379 351 *
380 352 * @param int $group_id ID of the current group. Available only on BP 2.2+.
381 353 */
382 354 public function display( $group_id = null ) {
@@ -397,13 +369,13 @@
397 369 $this->display_forums( 0 );
398 370 }
399 371
400 372 /**
401 - * Maybe unset the group forum nav item if group does not have a forum.
373 + * Maybe unset the group forum nav item if group does not have a forum
402 374 *
403 - * @since 2.3.0 bbPress (r4553)
375 + * @since 2.3.0 bbPress (r4552)
404 376 *
405 - * @return If not viewing a single group.
377 + * @return If not viewing a single group
406 378 */
407 379 public function maybe_unset_forum_menu() {
408 380
409 381 // Bail if not viewing a single group
@@ -420,9 +392,9 @@
420 392
421 393 /**
422 394 * Allow group members to have advanced privileges in group forum topics.
423 395 *
424 - * @since 2.3.0 bbPress (r4716)
396 + * @since 2.2.0 bbPress (r4434)
425 397 *
426 398 * @param array $caps
427 399 * @param string $cap
428 400 * @param int $user_id
@@ -470,10 +442,10 @@
470 442
471 443 switch ( $cap ) {
472 444
473 445 // If user is a group mmember, allow them to create content.
474 - case 'publish_replies' :
475 - case 'publish_topics' :
446 + case 'publish_replies' :
447 + case 'publish_topics' :
476 448 if ( bbp_group_is_banned() ) {
477 449 $caps = array( 'do_not_allow' );
478 450 } elseif ( bbp_group_is_member() || bbp_group_is_mod() || bbp_group_is_admin() ) {
479 451 $caps = array( 'participate' );
@@ -508,18 +480,9 @@
508 480 }
509 481 break;
510 482 }
511 483
512 - /**
513 - * Filters the Group Forum Topic meta capabilities.
514 - *
515 - * @since 2.2.0 bbPress (r4435)
516 - *
517 - * @param array $caps Capabilities for the meta capability.
518 - * @param string $cap Capability name.
519 - * @param int $user_id User ID.
520 - * @param array $args Arguments.
521 - */
484 + // Filter & return
522 485 return (array) apply_filters( 'bbp_map_group_forum_topic_meta_caps', $caps, $cap, $user_id, $args );
523 486 }
524 487
525 488 /**
@@ -524,12 +487,12 @@
524 487
525 488 /**
526 489 * Remove the topic meta cap map, so it doesn't interfere with sidebars.
527 490 *
528 - * @since 2.3.0 bbPress (r4717)
491 + * @since 2.2.0 bbPress (r4434)
529 492 */
530 493 public function remove_group_forum_meta_cap_map() {
531 - remove_filter( 'bbp_map_meta_caps', array( $this, 'map_group_forum_meta_caps' ), 10 );
494 + remove_filter( 'bbp_map_meta_caps', array( $this, 'map_group_forum_meta_caps' ), 99, 4 );
532 495 }
533 496
534 497 /**
535 498 * Validate the forum ID for a topic in a group forum.
@@ -541,11 +504,11 @@
541 504 * - A forum the current user can moderate outside of this group
542 505 *
543 506 * If all checks fail, an error gets added to prevent the topic from saving.
544 507 *
545 - * @since 2.6.14 bbPress (r7060)
508 + * @since 2.6.14
546 509 *
547 - * @param int $topic_id Topic id.
510 + * @param int $topic_id
548 511 */
549 512 public function validate_topic_forum_id( $topic_id = 0 ) {
550 513
551 514 // Bail if no topic
@@ -602,11 +565,11 @@
602 565 * be saved to the current topic.
603 566 *
604 567 * If all checks fail, an error gets added to prevent the reply from saving.
605 568 *
606 - * @since 2.6.14 bbPress (r7060)
569 + * @since 2.6.14
607 570 *
608 - * @param int $reply_id Reply id.
571 + * @param int $reply_id
609 572 */
610 573 public function validate_reply_to_id( $reply_id = 0 ) {
611 574
612 575 // Bail if no reply
@@ -660,11 +623,11 @@
660 623
661 624 /** Edit ******************************************************************/
662 625
663 626 /**
664 - * Show forums and new forum form when editing a group.
627 + * Show forums and new forum form when editing a group
665 628 *
666 - * @since 2.1.0 bbPress (r3552)
629 + * @since 2.1.0 bbPress (r3563)
667 630 *
668 631 * @param object $group (the group to edit if in Group Admin UI)
669 632 */
670 633 public function edit_screen( $group = false ) {
@@ -726,13 +689,13 @@
726 689 }
727 690 }
728 691
729 692 /**
730 - * Save the Group Forum data on edit.
693 + * Save the Group Forum data on edit
731 694 *
732 - * @since 2.1.0 bbPress (r3552)
695 + * @since 2.0.0 bbPress (r3465)
733 696 *
734 - * @param int $group_id (to handle Group Admin UI hook bp_group_admin_edit_after).
697 + * @param int $group_id (to handle Group Admin UI hook bp_group_admin_edit_after )
735 698 */
736 699 public function edit_screen_save( $group_id = 0 ) {
737 700
738 701 // Bail if not a POST action
@@ -766,9 +729,9 @@
766 729 // Normalize group forum relationships now
767 730 if ( ! empty( $forum_ids ) ) {
768 731
769 732 // Loop through forums, and make sure they exist
770 - foreach ( $forum_ids as $index => $forum_id ) {
733 + foreach ( $forum_ids as $forum_id ) {
771 734
772 735 // Look for forum
773 736 $forum = bbp_get_forum( $forum_id );
774 737
@@ -773,28 +736,22 @@
773 736 $forum = bbp_get_forum( $forum_id );
774 737
775 738 // No forum exists, so break the relationship
776 739 if ( empty( $forum ) ) {
777 - $this->remove_forum(
778 - array(
779 - 'forum_id' => $forum_id,
780 - 'group_id' => $group_id
781 - )
782 - );
783 - unset( $forum_ids[ $index ] );
740 + $this->remove_forum( array( 'forum_id' => $forum_id ) );
741 + unset( $forum_ids[ $forum_id ] );
784 742 }
785 743 }
786 744
787 745 // No support for multiple forums yet
788 - $forum_ids = array_values( $forum_ids );
789 - $forum_id = ! empty( $forum_ids ) ? (int) $forum_ids[0] : 0;
746 + $forum_id = (int) ( is_array( $forum_ids )
747 + ? $forum_ids[0]
748 + : $forum_ids );
790 749 }
791 750
792 751 // Update the group ID and forum ID relationships
793 752 bbp_update_group_forum_ids( $group_id, (array) $forum_ids );
794 - if ( ! empty( $forum_id ) ) {
795 - bbp_update_forum_group_ids( $forum_id, (array) $group_id );
796 - }
753 + bbp_update_forum_group_ids( $forum_id, (array) $group_id );
797 754
798 755 // Update the group forum setting
799 756 $group = $this->toggle_group_forum( $group_id, $edit_forum );
800 757
@@ -843,16 +800,16 @@
843 800 }
844 801 }
845 802
846 803 /**
847 - * Adds a meta-box to BuddyPress Group Admin UI.
804 + * Adds a meta-box to BuddyPress Group Admin UI
848 805 *
849 - * @since 2.3.0 bbPress (r4815)
806 + * @since 2.3.0 bbPress (r4814)
850 807 */
851 808 public function group_admin_ui_edit_screen() {
852 809 add_meta_box(
853 810 'bbpress_group_admin_ui_meta_box',
854 - esc_html_x( 'Forum', 'group admin edit screen', 'bbpress' ),
811 + _x( 'Discussion Forum', 'group admin edit screen', 'bbpress' ),
855 812 array( $this, 'group_admin_ui_display_metabox' ),
856 813 get_current_screen()->id,
857 814 'side',
858 815 'core'
@@ -859,13 +816,13 @@
859 816 );
860 817 }
861 818
862 819 /**
863 - * Displays the bbPress meta-box in BuddyPress Group Admin UI.
820 + * Displays the bbPress meta-box in BuddyPress Group Admin UI
864 821 *
865 - * @since 2.3.0 bbPress (r4815)
822 + * @since 2.3.0 bbPress (r4814)
866 823 *
867 - * @param object $item (group object).
824 + * @param object $item (group object)
868 825 */
869 826 public function group_admin_ui_display_metabox( $item ) {
870 827 $this->edit_screen( $item );
871 828 }
@@ -872,11 +829,11 @@
872 829
873 830 /** Create ****************************************************************/
874 831
875 832 /**
876 - * Show forums and new forum form when creating a group.
833 + * Show forums and new forum form when creating a group
877 834 *
878 - * @since 2.1.0 bbPress (r3552)
835 + * @since 2.0.0 bbPress (r3465)
879 836 */
880 837 public function create_screen( $group_id = 0 ) {
881 838
882 839 // Bail if not looking at this screen
@@ -902,11 +859,11 @@
902 859 <?php
903 860 }
904 861
905 862 /**
906 - * Save the Group Forum data on create.
863 + * Save the Group Forum data on create
907 864 *
908 - * @since 2.1.0 bbPress (r3552)
865 + * @since 2.0.0 bbPress (r3465)
909 866 */
910 867 public function create_screen_save( $group_id = 0 ) {
911 868
912 869 // Nonce check
@@ -991,9 +948,9 @@
991 948 }
992 949 }
993 950
994 951 /**
995 - * Used to start an output buffer.
952 + * Used to start an output buffer
996 953 *
997 954 * @since 2.1.0 bbPress (r3746)
998 955 */
999 956 public function ob_start() {
@@ -1000,9 +957,9 @@
1000 957 ob_start();
1001 958 }
1002 959
1003 960 /**
1004 - * Used to end an output buffer.
961 + * Used to end an output buffer
1005 962 *
1006 963 * @since 2.1.0 bbPress (r3746)
1007 964 */
1008 965 public function ob_end_clean() {
@@ -1009,15 +966,15 @@
1009 966 ob_end_clean();
1010 967 }
1011 968
1012 969 /**
1013 - * Creating a group forum or category (including root for group).
970 + * Creating a group forum or category (including root for group)
1014 971 *
1015 - * @since 2.1.0 bbPress (r3654)
972 + * @since 2.1.0 bbPress (r3653)
1016 973 *
1017 974 * @param array $forum_args
1018 975 *
1019 - * @return void if no forum_id is available.
976 + * @return void if no forum_id is available
1020 977 */
1021 978 public function new_forum( $forum_args = array() ) {
1022 979
1023 980 // Bail if no forum_id was passed
@@ -1026,11 +983,9 @@
1026 983 }
1027 984
1028 985 // Validate forum_id
1029 986 $forum_id = bbp_get_forum_id( $forum_args['forum_id'] );
1030 - $group_id = ! empty( $forum_args['group_id'] )
1031 - ? $forum_args['group_id']
1032 - : bp_get_current_group_id();
987 + $group_id = ! empty( $forum_args['group_id'] ) ? $forum_args['group_id'] : bp_get_current_group_id();
1033 988
1034 989 bbp_add_forum_id_to_group( $group_id, $forum_id );
1035 990 bbp_add_group_id_to_forum( $forum_id, $group_id );
1036 991 }
@@ -1035,15 +990,15 @@
1035 990 bbp_add_group_id_to_forum( $forum_id, $group_id );
1036 991 }
1037 992
1038 993 /**
1039 - * Removing a group forum or category (including root for group).
994 + * Removing a group forum or category (including root for group)
1040 995 *
1041 - * @since 2.1.0 bbPress (r3654)
996 + * @since 2.1.0 bbPress (r3653)
1042 997 *
1043 998 * @param array $forum_args
1044 999 *
1045 - * @return void if no forum_id is available.
1000 + * @return void if no forum_id is available
1046 1001 */
1047 1002 public function remove_forum( $forum_args = array() ) {
1048 1003
1049 1004 // Bail if no forum_id was passed
@@ -1052,28 +1007,20 @@
1052 1007 }
1053 1008
1054 1009 // Validate forum_id
1055 1010 $forum_id = bbp_get_forum_id( $forum_args['forum_id'] );
1056 - $group_id = ! empty( $forum_args['group_id'] )
1057 - ? $forum_args['group_id']
1058 - : bp_get_current_group_id();
1011 + $group_id = ! empty( $forum_args['group_id'] ) ? $forum_args['group_id'] : bp_get_current_group_id();
1059 1012
1060 1013 bbp_remove_forum_id_from_group( $group_id, $forum_id );
1061 1014 bbp_remove_group_id_from_forum( $forum_id, $group_id );
1062 -
1063 - // A private group forum must not become a regular private forum when
1064 - // its last group relationship is removed.
1065 - if ( empty( bbp_get_forum_group_ids( $forum_id ) ) && bbp_is_forum_private( $forum_id, false ) ) {
1066 - bbp_hide_forum( $forum_id, bbp_get_private_status_id() );
1067 - }
1068 1015 }
1069 1016
1070 1017 /**
1071 - * Listening to BuddyPress Group deletion to remove the forum.
1018 + * Listening to BuddyPress Group deletion to remove the forum
1072 1019 *
1073 1020 * @since 2.3.0 bbPress (r4815)
1074 1021 *
1075 - * @param int $group_id The group ID.
1022 + * @param int $group_id The group ID
1076 1023 */
1077 1024 public function disconnect_forum_from_group( $group_id = 0 ) {
1078 1025
1079 1026 // Bail if no group ID available
@@ -1088,24 +1035,27 @@
1088 1035 if ( empty( $forum_ids ) ) {
1089 1036 return;
1090 1037 }
1091 1038
1092 - foreach ( (array) $forum_ids as $forum_id ) {
1093 - $this->remove_forum(
1094 - array(
1095 - 'forum_id' => (int) $forum_id,
1096 - 'group_id' => $group_id
1097 - )
1098 - );
1099 - }
1039 + // Get the first forum ID
1040 + $forum_id = (int) is_array( $forum_ids )
1041 + ? $forum_ids[0]
1042 + : $forum_ids;
1043 +
1044 + $this->remove_forum(
1045 + array(
1046 + 'forum_id' => $forum_id,
1047 + 'group_id' => $group_id
1048 + )
1049 + );
1100 1050 }
1101 1051
1102 1052 /**
1103 1053 * Update forum attributes to match those of the associated group.
1104 1054 *
1105 - * Fired whenever a group is saved.
1055 + * Fired whenever a group is saved
1106 1056 *
1107 - * @since 2.6.7 bbPress (r7210)
1057 + * @since 2.6.7 bbPress (r7208)
1108 1058 *
1109 1059 * @param BP_Groups_Group $group Group object.
1110 1060 */
1111 1061 public static function update_group_forum( BP_Groups_Group $group ) {
@@ -1181,15 +1131,15 @@
1181 1131 }
1182 1132 }
1183 1133
1184 1134 /**
1185 - * Toggle the enable_forum group setting on or off.
1135 + * Toggle the enable_forum group setting on or off
1186 1136 *
1187 - * @since 2.3.0 bbPress (r4613)
1137 + * @since 2.3.0 bbPress (r4612)
1188 1138 *
1189 - * @param int $group_id The group to toggle.
1190 - * @param bool $enabled True for on, false for off.
1191 - * @return False if group is not found, otherwise return the group.
1139 + * @param int $group_id The group to toggle
1140 + * @param bool $enabled True for on, false for off
1141 + * @return False if group is not found, otherwise return the group
1192 1142 */
1193 1143 public function toggle_group_forum( $group_id = 0, $enabled = false ) {
1194 1144
1195 1145 // Get the group
@@ -1220,14 +1170,14 @@
1220 1170
1221 1171 /** Display Methods *******************************************************/
1222 1172
1223 1173 /**
1224 - * Output the forums for a group in the edit screens.
1174 + * Output the forums for a group in the edit screens
1225 1175 *
1226 1176 * As of right now, bbPress only supports 1-to-1 group forum relationships.
1227 1177 * In the future, many-to-many should be allowed.
1228 1178 *
1229 - * @since 2.1.0 bbPress (r3746)
1179 + * @since 2.1.0 bbPress (r3653)
1230 1180 */
1231 1181 public function display_forums( $offset = 0 ) {
1232 1182
1233 1183 // Allow actions immediately before group forum output
@@ -1389,18 +1339,10 @@
1389 1339 'posts_per_page' => 1
1390 1340 )
1391 1341 );
1392 1342
1393 - // Check the reply and its topic before rendering either one.
1394 - $reply_visible = bbp_replies();
1395 - if ( $reply_visible ) {
1396 - $reply_id = bbp_get_reply_id( $bbp->reply_query->post->ID );
1397 - $topic_id = bbp_get_reply_topic_id( $reply_id );
1398 - $reply_visible = ( bbp_is_reply_public( $reply_id ) || current_user_can( 'read_reply', $reply_id ) ) && ( bbp_is_topic_public( $topic_id ) || current_user_can( 'read_topic', $topic_id ) );
1399 - }
1400 -
1401 1343 // If no topic, 404
1402 - if ( ! $reply_visible ) {
1344 + if ( ! bbp_replies() ) {
1403 1345 bp_do_404( bbp_get_forum_permalink( $forum_id ) );
1404 1346
1405 1347 // Only wrap title in H2 if not empty
1406 1348 $title = bbp_get_forum_title();
@@ -1448,9 +1390,8 @@
1448 1390 break;
1449 1391 endswitch;
1450 1392
1451 1393 // Reset the query
1452 - // phpcs:ignore WordPress.WP.DiscouragedFunctions.wp_reset_query_wp_reset_query
1453 1394 wp_reset_query(); ?>
1454 1395
1455 1396 </div><!-- #bbpress-forums -->
1456 1397
@@ -1462,14 +1403,14 @@
1462 1403
1463 1404 /** Super sticky filters ***************************************************/
1464 1405
1465 1406 /**
1466 - * Strip super stickies from the topic query.
1407 + * Strip super stickies from the topic query
1467 1408 *
1468 - * @since 2.3.0 bbPress (r4809)
1409 + * @since 2.3.0 bbPress (r4810)
1469 1410 *
1470 1411 * @access private
1471 - * @param array $super the super sticky post ID's.
1412 + * @param array $super the super sticky post ID's
1472 1413 * @return array (empty)
1473 1414 */
1474 1415 public function no_super_stickies( $super = array() ) {
1475 1416 $super = array();
@@ -1476,15 +1417,15 @@
1476 1417 return $super;
1477 1418 }
1478 1419
1479 1420 /**
1480 - * Unset the type super sticky from topic type.
1421 + * Unset the type super sticky from topic type
1481 1422 *
1482 - * @since 2.3.0 bbPress (r4809)
1423 + * @since 2.3.0 bbPress (r4810)
1483 1424 *
1484 1425 * @access private
1485 1426 * @param array $args
1486 - * @return array $args without the to-front link.
1427 + * @return array $args without the to-front link
1487 1428 */
1488 1429 public function unset_super_sticky( $args = array() ) {
1489 1430 if ( isset( $args['super'] ) ) {
1490 1431 unset( $args['super'] );
@@ -1492,16 +1433,16 @@
1492 1433 return $args;
1493 1434 }
1494 1435
1495 1436 /**
1496 - * Ugly preg_replace to hide the to front admin link.
1437 + * Ugly preg_replace to hide the to front admin link
1497 1438 *
1498 - * @since 2.3.0 bbPress (r4809)
1439 + * @since 2.3.0 bbPress (r4810)
1499 1440 *
1500 1441 * @access private
1501 1442 * @param string $retval
1502 1443 * @param array $args
1503 - * @return string $retval without the to-front link.
1444 + * @return string $retval without the to-front link
1504 1445 */
1505 1446 public function hide_super_sticky_admin_link( $retval = '', $args = array() ) {
1506 1447 if ( strpos( $retval, '(' ) ) {
1507 1448 $retval = preg_replace( '/(\(.+?)+(\))/i', '', $retval );
@@ -1512,11 +1453,11 @@
1512 1453
1513 1454 /** Redirect Helpers ******************************************************/
1514 1455
1515 1456 /**
1516 - * Redirect to the group forum screen.
1457 + * Redirect to the group forum screen
1517 1458 *
1518 - * @since 2.1.0 bbPress (r3789)
1459 + * @since 2.1.0 bbPress (r3653)
1519 1460 *
1520 1461 * @param str $redirect_url
1521 1462 * @param str $redirect_to
1522 1463 */
@@ -1530,11 +1471,11 @@
1530 1471 return $redirect_url;
1531 1472 }
1532 1473
1533 1474 /**
1534 - * Redirect to the group forum screen.
1475 + * Redirect to the group forum screen
1535 1476 *
1536 - * @since 2.1.0 bbPress (r3799)
1477 + * @since 2.1.0 bbPress (r3653)
1537 1478 */
1538 1479 public function new_reply_redirect_to( $redirect_url = '', $redirect_to = '', $reply_id = 0 ) {
1539 1480
1540 1481 if ( bp_is_group() ) {
@@ -1563,11 +1504,11 @@
1563 1504 return $redirect_url;
1564 1505 }
1565 1506
1566 1507 /**
1567 - * Redirect to the group admin forum edit screen.
1508 + * Redirect to the group admin forum edit screen
1568 1509 *
1569 - * @since 2.1.0 bbPress (r3654)
1510 + * @since 2.1.0 bbPress (r3653)
1570 1511 */
1571 1512 public function edit_redirect_to( $redirect_url = '' ) {
1572 1513
1573 1514 // Get the current group, if there is one
@@ -1643,9 +1584,9 @@
1643 1584
1644 1585 /**
1645 1586 * Permissions to view the 'New Topic'/'Reply To' form in a BuddyPress group.
1646 1587 *
1647 - * @since 2.3.0 bbPress (r4609)
1588 + * @since 2.3.0 bbPress (r4608)
1648 1589 *
1649 1590 * @param bool $retval Are we allowed to view the reply form?
1650 1591 *
1651 1592 * @return bool
@@ -1678,9 +1619,9 @@
1678 1619 *
1679 1620 * Due to the way BuddyPress' group admin settings page saves its settings,
1680 1621 * we need to let BP know that bbPress added a forum.
1681 1622 *
1682 - * @since 2.4.0 bbPress (r5027)
1623 + * @since 2.4.0 bbPress (r5026)
1683 1624 *
1684 1625 * @link https://bbpress.trac.wordpress.org/ticket/2339/
1685 1626 * @see groups_screen_group_admin_settings()
1686 1627 */
@@ -1700,9 +1641,9 @@
1700 1641
1701 1642 /**
1702 1643 * Get the URL for a group.
1703 1644 *
1704 - * @since 2.6.14 bbPress (r7316)
1645 + * @since 2.6.14
1705 1646 *
1706 1647 * @param int $group_id
1707 1648 * @return string
1708 1649 */
@@ -1726,9 +1667,9 @@
1726 1667
1727 1668 /**
1728 1669 * Get the management URL for a group.
1729 1670 *
1730 - * @since 2.6.14 bbPress (r7316)
1671 + * @since 2.6.14
1731 1672 *
1732 1673 * @param int $group_id
1733 1674 * @return string
1734 1675 */
@@ -1750,14 +1691,14 @@
1750 1691 return $retval;
1751 1692 }
1752 1693
1753 1694 /**
1754 - * Maybe map a bbPress forum/topic/reply permalink to the corresponding group.
1695 + * Maybe map a bbPress forum/topic/reply permalink to the corresponding group
1755 1696 *
1756 - * @since 2.2.0 bbPress (r4395)
1697 + * @since 2.2.0 bbPress (r4266)
1757 1698 *
1758 1699 * @param int $post_id
1759 - * @return Bail early if not a group forum post.
1700 + * @return Bail early if not a group forum post
1760 1701 * @return string
1761 1702 */
1762 1703 private function maybe_map_permalink_to_group( $post_id = 0, $url = false ) {
1763 1704
@@ -1806,11 +1747,11 @@
1806 1747 return trailingslashit( trailingslashit( trailingslashit( $group_permalink ) . $this->slug ) . $url_end );
1807 1748 }
1808 1749
1809 1750 /**
1810 - * Map a forum permalink to its corresponding group.
1751 + * Map a forum permalink to its corresponding group
1811 1752 *
1812 - * @since 2.1.0 bbPress (r3746)
1753 + * @since 2.1.0 bbPress (r3802)
1813 1754 *
1814 1755 * @param string $url
1815 1756 * @param int $forum_id
1816 1757 * @return string
@@ -1819,11 +1760,11 @@
1819 1760 return $this->maybe_map_permalink_to_group( $forum_id, $url );
1820 1761 }
1821 1762
1822 1763 /**
1823 - * Map a topic permalink to its group forum.
1764 + * Map a topic permalink to its group forum
1824 1765 *
1825 - * @since 2.1.0 bbPress (r3746)
1766 + * @since 2.1.0 bbPress (r3802)
1826 1767 *
1827 1768 * @param string $url
1828 1769 * @param int $topic_id
1829 1770 * @return string
@@ -1832,11 +1773,11 @@
1832 1773 return $this->maybe_map_permalink_to_group( $topic_id, $url );
1833 1774 }
1834 1775
1835 1776 /**
1836 - * Map a reply permalink to its group forum.
1777 + * Map a reply permalink to its group forum
1837 1778 *
1838 - * @since 2.1.0 bbPress (r3746)
1779 + * @since 2.1.0 bbPress (r3802)
1839 1780 *
1840 1781 * @param string $url
1841 1782 * @param int $reply_id
1842 1783 * @return string
@@ -1845,11 +1786,11 @@
1845 1786 return $this->maybe_map_permalink_to_group( bbp_get_reply_topic_id( $reply_id ), $url );
1846 1787 }
1847 1788
1848 1789 /**
1849 - * Map a reply edit link to its group forum.
1790 + * Map a reply edit link to its group forum
1850 1791 *
1851 - * @since 2.2.0 bbPress (r4395)
1792 + * @since 2.2.0 bbPress (r4266)
1852 1793 *
1853 1794 * @param string $url
1854 1795 * @param int $reply_id
1855 1796 * @return string
@@ -1864,11 +1805,11 @@
1864 1805 return trailingslashit( $new ) . bbpress()->edit_id . '/';
1865 1806 }
1866 1807
1867 1808 /**
1868 - * Map a post link to its group forum.
1809 + * Map a post link to its group forum
1869 1810 *
1870 - * @since 2.2.0 bbPress (r4395)
1811 + * @since 2.2.0 bbPress (r4266)
1871 1812 *
1872 1813 * @param string $url
1873 1814 * @param obj $post
1874 1815 * @param boolean $leavename
@@ -1878,11 +1819,11 @@
1878 1819 return $this->maybe_map_permalink_to_group( $post->ID, $url );
1879 1820 }
1880 1821
1881 1822 /**
1882 - * Map a page link to its group forum.
1823 + * Map a page link to its group forum
1883 1824 *
1884 - * @since 2.2.0 bbPress (r4395)
1825 + * @since 2.2.0 bbPress (r4266)
1885 1826 *
1886 1827 * @param string $url
1887 1828 * @param int $post_id
1888 1829 * @param $sample
@@ -1892,11 +1833,11 @@
1892 1833 return $this->maybe_map_permalink_to_group( $post_id, $url );
1893 1834 }
1894 1835
1895 1836 /**
1896 - * Map a custom post type link to its group forum.
1837 + * Map a custom post type link to its group forum
1897 1838 *
1898 - * @since 2.2.0 bbPress (r4395)
1839 + * @since 2.2.0 bbPress (r4266)
1899 1840 *
1900 1841 * @param string $url
1901 1842 * @param obj $post
1902 1843 * @param $leavename
@@ -1907,11 +1848,11 @@
1907 1848 return $this->maybe_map_permalink_to_group( $post->ID, $url );
1908 1849 }
1909 1850
1910 1851 /**
1911 - * Fix pagination of topics on forum view.
1852 + * Fix pagination of topics on forum view
1912 1853 *
1913 - * @since 2.2.0 bbPress (r4395)
1854 + * @since 2.2.0 bbPress (r4266)
1914 1855 *
1915 1856 * @param array $args
1916 1857 * @return array
1917 1858 */
@@ -1927,11 +1868,11 @@
1927 1868 return $args;
1928 1869 }
1929 1870
1930 1871 /**
1931 - * Fix pagination of replies on topic view.
1872 + * Fix pagination of replies on topic view
1932 1873 *
1933 - * @since 2.2.0 bbPress (r4395)
1874 + * @since 2.2.0 bbPress (r4266)
1934 1875 *
1935 1876 * @param array $args
1936 1877 * @return array
1937 1878 */
@@ -1951,13 +1892,13 @@
1951 1892 *
1952 1893 * Required for compatibility with BuddyPress > 12.0, where the /groups/
1953 1894 * rewrite rule will be caught before bbPress's /page/ rule.
1954 1895 *
1955 - * @since 2.6.14 bbPress (r7316)
1896 + * @since 2.6.14
1956 1897 *
1957 - * @param object $query Verified query object.
1958 - * @param string $type Type of variable to compare to.
1959 - * @return mixed Verified object if valid, Default or null if invalid.
1898 + * @param object object Verified object
1899 + * @param string $type Type of variable to check with `is_a()`
1900 + * @return mixed $object Verified object if valid, Default or null if invalid
1960 1901 */
1961 1902 public function rewrite_pagination( $query, $type = '' ) {
1962 1903
1963 1904 // Bail if wrong global
@@ -2009,9 +1950,9 @@
2009 1950 /**
2010 1951 * Ensure that forum content associated with a BuddyPress group can only be
2011 1952 * viewed via the group URL.
2012 1953 *
2013 - * @since 2.2.0 bbPress (r4395)
1954 + * @since 2.1.0 bbPress (r3802)
2014 1955 */
2015 1956 public function redirect_canonical() {
2016 1957
2017 1958 // Bail if on a RSS feed
@@ -2059,9 +2000,9 @@
2059 2000
2060 2001 /**
2061 2002 * Map a forum post to its corresponding group in the group activity stream.
2062 2003 *
2063 - * @since 2.2.0 bbPress (r4399)
2004 + * @since 2.2.0 bbPress (r4396)
2064 2005 *
2065 2006 * @param array $args Arguments from BBP_BuddyPress_Activity::record_activity()
2066 2007 *
2067 2008 * @return array