Changeset 9982
- Timestamp:
- 06/30/2015 06:22:31 AM (9 years ago)
- Location:
- trunk/src/bp-groups
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-actions.php
r9906 r9982 2 2 3 3 /** 4 * BuddyPress Groups Actions 4 * BuddyPress Groups Actions. 5 5 * 6 6 * Action functions are exactly the same as screen functions, however they do … … 63 63 * @since BuddyPress (2.1.0) 64 64 * 65 * @param bool $user_has_access True if the user has access to the 66 * content, otherwise false. 67 * @param array $no_access_args Arguments to be passed to 68 * bp_core_no_access() in case of no access. Note that this 69 * value is passed by reference, so it can be modified by the 70 * filter callback. 65 * @param bool $user_has_access True if the user has access to the 66 * content, otherwise false. 67 * @param array $no_access_args Arguments to be passed to bp_core_no_access() in case 68 * of no access. Note that this value is passed by reference, 69 * so it can be modified by the filter callback. 71 70 */ 72 71 $user_has_access = apply_filters_ref_array( 'bp_group_user_has_access', array( $user_has_access, &$no_access_args ) ); 73 72 74 // If user has access, we return rather than redirect 73 // If user has access, we return rather than redirect. 75 74 if ( $user_has_access ) { 76 75 return; … … 79 78 // Hidden groups should return a 404 for non-members. 80 79 // Unset the current group so that you're not redirected 81 // to the default group tab 80 // to the default group tab. 82 81 if ( 'hidden' == $current_group->status ) { 83 82 buddypress()->groups->current_group = 0; -
trunk/src/bp-groups/classes/class-bp-group-extension.php
r9907 r9982 1 1 <?php 2 2 /** 3 * BuddyPress Groups Classes 3 * BuddyPress Groups Classes. 4 4 * 5 5 * @package BuddyPress … … 291 291 292 292 /** 293 * The content of the group tab 293 * The content of the group tab. 294 294 * 295 295 * @param int|null $group_id … … 319 319 320 320 /** 321 * Initialize the extension, using your config settings 321 * Initialize the extension, using your config settings. 322 322 * 323 323 * Your plugin should call this method at the very end of its … … 339 339 * @param array $args { 340 340 * Array of initialization arguments. 341 * @type string $slug Unique, URL-safe identifier for your 342 * extension. 343 * @type string $name Translatable name for your extension. Used to 344 * populate navigation items. 345 * @type string $visibility Optional. Set to 'public' for your 346 * extension (the main tab as well as the widget) to be 347 * available to anyone who can access the group; set to 348 * 'private' otherwise. Default: 'public'. 349 * @type int $nav_item_position Optional. Location of the nav item 350 * in the tab list. Default: 81. 351 * @type bool $enable_nav_item Optional. Whether the extension's 352 * tab should be accessible to anyone who can view the group. 353 * Default: true. 354 * @type string $nav_item_name Optional. The translatable text you 355 * want to appear in the nav tab. Default: the value of $name. 356 * @type string $display_hook Optional. The WordPress action that 357 * the widget_display() method is hooked to. 358 * Default: 'groups_custom_group_boxes'. 359 * @type string $template_file Optional. Theme-relative path to the 360 * template file BP should use to load the content of your 361 * main extension tab. Default: 'groups/single/plugins.php'. 362 * @type array $screens A multi-dimensional array of configuration 363 * information for the extension screens. See docblock of 364 * {@link BP_Group_Extension} for more details. 365 * @type string|array $access Which users can visit the plugin's tab. 366 * Possible values: 'anyone', 'loggedin', 'member', 367 * 'mod', 'admin' or 'noone'. ('member', 'mod', 'admin' 368 * refer to user's role in group.) Note that 'mod' targets only 369 * group moderators. If you want to allow access to group 370 * moderators and admins, specify `array( 'mod', 'admin' )`. 371 * Defaults to 'anyone' for public groups and 'member' for 372 * private groups. 373 * @type string|array $show_tab Which users can see the plugin's 374 * navigation tab. 375 * Possible values: 'anyone', 'loggedin', 'member', 376 * 'mod', 'admin' or 'noone'. ('member', 'mod', 'admin' 377 * refer to user's role in group.) Note that 'mod' targets only 378 * group moderators. If you want to show the tab to group 379 * moderators and admins, specify `array( 'mod', 'admin' )`. 380 * Defaults to 'anyone' for public groups and 'member' for 381 * private groups. 341 * @type string $slug Unique, URL-safe identifier for your 342 * extension. 343 * @type string $name Translatable name for your extension. Used to 344 * populate navigation items. 345 * @type string $visibility Optional. Set to 'public' for your 346 * extension (the main tab as well as the widget) to be 347 * available to anyone who can access the group; set to 348 * 'private' otherwise. Default: 'public'. 349 * @type int $nav_item_ Position Optional. Location of the nav item 350 * in the tab list. Default: 81. 351 * @type bool $enable_nav_item Optional. Whether the extension's tab should be 352 * accessible to anyone who can view the group. 353 * Default: true. 354 * @type string $nav_item_name Optional. The translatable text you want to appear 355 * in the nav tab. Default: the value of $name. 356 * @type string $display_hook Optional. The WordPress action that 357 * the widget_display() method is hooked to. 358 * Default: 'groups_custom_group_boxes'. 359 * @type string $template_file Optional. Theme-relative path to the template file 360 * BP should use to load the content of your main 361 * extension tab. Default: 'groups/single/plugins.php'. 362 * @type array $screens A multi-dimensional array of configuration 363 * information for the extension screens. See docblock of 364 * {@link BP_Group_Extension} for more details. 365 * @type string|array $access Which users can visit the plugin's tab. 366 * Possible values: 'anyone', 'loggedin', 'member', 367 * 'mod', 'admin' or 'noone'. ('member', 'mod', 'admin' 368 * refer to user's role in group.) Note that 'mod' targets only 369 * group moderators. If you want to allow access to group 370 * moderators and admins, specify `array( 'mod', 'admin' )`. 371 * Defaults to 'anyone' for public groups and 'member' for 372 * private groups. 373 * @type string|array $show_tab Which users can see the plugin's navigation tab. 374 * Possible values: 'anyone', 'loggedin', 'member', 375 * 'mod', 'admin' or 'noone'. ('member', 'mod', 'admin' 376 * refer to user's role in group.) Note that 'mod' targets only 377 * group moderators. If you want to show the tab to group 378 * moderators and admins, specify `array( 'mod', 'admin' )`. 379 * Defaults to 'anyone' for public groups and 'member' for 380 * private groups. 382 381 * } 383 382 */ … … 679 678 * 680 679 * @param string $access_condition 'anyone', 'loggedin', 'member', 681 * 'mod', 'admin' or 'noone'.680 * 'mod', 'admin' or 'noone'. 682 681 * @return bool 683 682 */ … … 768 767 769 768 /** 770 * Hook the main display method, and loads the template file 769 * Hook the main display method, and loads the template file. 771 770 */ 772 771 public function _display_hook() { … … 803 802 * @since BuddyPress (2.1.0) 804 803 * 804 * @param bool $user_can_see_nav_item 805 * 805 806 * @return bool 806 807 */ … … 818 819 * @since BuddyPress (2.1.0) 819 820 * 821 * @param bool $user_can_visit 822 * 820 823 * @return bool 821 824 */ … … 837 840 * @since BuddyPress (2.1.0) 838 841 * 839 * @param bool $user_can_visit842 * @param bool $user_can_visit 840 843 * @param array $no_access_args 844 * 841 845 * @return bool 842 846 */ … … 1113 1117 * 1114 1118 * @param string $screen The markup to check. 1119 * 1115 1120 * @return bool True if a Submit button is found, otherwise false. 1116 1121 */ … … 1171 1176 1172 1177 /** 1173 * Check the nonce, and call the admin_screen_save() method 1178 * Check the nonce, and call the admin_screen_save() method. 1174 1179 * 1175 1180 * @since BuddyPress (1.8.0) … … 1240 1245 * 1241 1246 * @param string $context Screen context. 'create', 'edit', or 'admin'. 1247 * 1242 1248 * @return bool True if the screen is enabled, otherwise false. 1243 1249 */ … … 1287 1293 * 1288 1294 * @param string $context Screen context. 'create', 'edit', or 'admin'. 1289 * @param string $type Screen type. 'screen' or 'screen_save'. Default: 1290 * 'screen'. 1295 * @param string $type Screen type. 'screen' or 'screen_save'. Default: 1296 * 'screen'. 1297 * 1291 1298 * @return callable A callable function handle. 1292 1299 */ … … 1338 1345 * @param array $a First set of arguments. 1339 1346 * @param array $b Second set of arguments. 1347 * 1340 1348 * @return array Parsed arguments. 1341 1349 */ … … 1381 1389 * 1382 1390 * @param string $key Property name. 1391 * 1383 1392 * @return mixed The value if found, otherwise null. 1384 1393 */ … … 1405 1414 * 1406 1415 * @param string $key Property name. 1416 * 1407 1417 * @return bool True if the value is set, otherwise false. 1408 1418 */ -
trunk/src/bp-groups/classes/class-bp-groups-group.php
r9906 r9982 1 1 <?php 2 2 /** 3 * BuddyPress Groups Classes 3 * BuddyPress Groups Classes. 4 4 * 5 5 * @package BuddyPress … … 160 160 * @param array $args { 161 161 * Array of optional arguments. 162 * @type bool $populate_extras Whether to fetch "extra" data about 163 * the group(group admins/mods, access for the current user).164 * Default: false.162 * @type bool $populate_extras Whether to fetch "extra" data about the group 163 * (group admins/mods, access for the current user). 164 * Default: false. 165 165 * } 166 166 */ … … 444 444 * 445 445 * @param string $slug See {@link BP_Groups_Group::group_exists()}. 446 * 446 447 * @return string|null See {@link BP_Groups_Group::group_exists()}. 447 448 */ … … 455 456 * @param int $user_id ID of the inviting user. 456 457 * @param int $group_id ID of the group. 458 * 457 459 * @return array IDs of users who have been invited to the group by the 458 * user but have not yet accepted.460 * user but have not yet accepted. 459 461 */ 460 462 public static function get_invites( $user_id, $group_id ) { … … 469 471 * Get a list of a user's groups, filtered by a search string. 470 472 * 471 * @param string $filterSearch term. Matches against 'name' and472 * 'description' fields.473 * @param int $user_id ID of the user whose groups are being searched.474 * Default: the displayed user.475 * @param mixed $orderNot used.476 * @param int|null $limit Optional. The max number of results to return.477 * Default: null (no limit).478 * @param int|null $page Optional. The page offset of results to return.479 * Default: null (no limit).473 * @param string $filter Search term. Matches against 'name' and 474 * 'description' fields. 475 * @param int $user_id ID of the user whose groups are being searched. 476 * Default: the displayed user. 477 * @param mixed $order Not used. 478 * @param int|null $limit Optional. The max number of results to return. 479 * Default: null (no limit). 480 * @param int|null $page Optional. The page offset of results to return. 481 * Default: null (no limit). 480 482 * @return false|array { 481 483 * @type array $groups Array of matched and paginated group objects. 482 * @type int $totalTotal count of groups matching the query.484 * @type int $total Total count of groups matching the query. 483 485 * } 484 486 */ … … 515 517 * Get a list of groups, filtered by a search string. 516 518 * 517 * @param string $filterSearch term. Matches against 'name' and518 * 'description' fields.519 * @param int|null $limitOptional. The max number of results to return.520 * Default: null (no limit).521 * @param int|null $pageOptional. The page offset of results to return.522 * Default: null (no limit).519 * @param string $filter Search term. Matches against 'name' and 520 * 'description' fields. 521 * @param int|null $limit Optional. The max number of results to return. 522 * Default: null (no limit). 523 * @param int|null $page Optional. The page offset of results to return. 524 * Default: null (no limit). 523 525 * @param string|bool $sort_by Column to sort by. Default: false (default 524 526 * sort). 525 * @param string|bool $order ASC or DESC. Default: false (default sort). 527 * @param string|bool $order ASC or DESC. Default: false (default sort). 528 * 526 529 * @return array { 527 530 * @type array $groups Array of matched and paginated group objects. 528 * @type int $totalTotal count of groups matching the query.531 * @type int $total Total count of groups matching the query. 529 532 * } 530 533 */ … … 560 563 * 561 564 * @param string $slug Slug to check. 565 * 562 566 * @return string|null The slug, if found. Otherwise null. 563 567 */ … … 574 578 * 575 579 * @param int $group_id ID of the group. 580 * 576 581 * @return string|null The slug, if found. Otherwise null. 577 582 */ … … 588 593 * 589 594 * @param int $group_id ID of the group. 595 * 590 596 * @return bool True if the group has members, otherwise false. 591 597 */ … … 607 613 * 608 614 * @param int $group_id ID of the group. 615 * 609 616 * @return int|null The number of outstanding requests, or null if 610 * none are found.617 * none are found. 611 618 */ 612 619 public static function has_membership_requests( $group_id ) { … … 621 628 * Get outstanding membership requests for a group. 622 629 * 623 * @param int $group_id ID of the group.624 * @param int|null $limit Optional. Max number of results to return.625 * Default: null (no limit).626 * @param int|null $page Optional. Page offset of results returned. Default:627 * null (no limit).630 * @param int $group_id ID of the group. 631 * @param int|null $limit Optional. Max number of results to return. 632 * Default: null (no limit). 633 * @param int|null $page Optional. Page offset of results returned. Default: 634 * null (no limit). 628 635 * @return array { 629 636 * @type array $requests The requested page of located requests. 630 * @type int $totalTotal number of requests outstanding for the631 * group.637 * @type int $total Total number of requests outstanding for the 638 * group. 632 639 * } 633 640 */ … … 655 662 * @param array { 656 663 * Array of parameters. All items are optional. 657 * @type string $type Optional. Shorthand for certain orderby/ 658 * order combinations. 'newest', 'active', 'popular', 659 * 'alphabetical', 'random'. When present, will override 660 * orderby and order params. Default: null. 661 * @type string $orderby Optional. Property to sort by. 662 * 'date_created', 'last_activity', 'total_member_count', 663 * 'name', 'random'. Default: 'date_created'. 664 * @type string $order Optional. Sort order. 'ASC' or 'DESC'. 665 * Default: 'DESC'. 666 * @type int $per_page Optional. Number of items to return per page 667 * of results. Default: null (no limit). 668 * @type int $page Optional. Page offset of results to return. 669 * Default: null (no limit). 670 * @type int $user_id Optional. If provided, results will be limited 671 * to groups of which the specified user is a member. Default: 672 * null. 673 * @type string $search_terms Optional. If provided, only groups 674 * whose names or descriptions match the search terms will be 675 * returned. Default: false. 676 * @type array $meta_query Optional. An array of meta_query 677 * conditions. See {@link WP_Meta_Query::queries} for 678 * description. 679 * @type array|string Optional. Array or comma-separated list of 680 * group IDs. Results will be limited to groups within the 681 * list. Default: false. 682 * @type bool $populate_extras Whether to fetch additional 683 * information (such as member count) about groups. Default: 684 * true. 685 * @type array|string $exclude Optional. Array or comma-separated 686 * list of group IDs. Results will exclude the listed groups. 687 * Default: false. 688 * @type bool $update_meta_cache Whether to pre-fetch groupmeta for 689 * the returned groups. Default: true. 690 * @type bool $show_hidden Whether to include hidden groups in 691 * results. Default: false. 664 * @type string $type Optional. Shorthand for certain orderby/ 665 * order combinations. 'newest', 'active', 'popular', 666 * 'alphabetical', 'random'. When present, will override 667 * orderby and order params. Default: null. 668 * @type string $orderby Optional. Property to sort by. 669 * 'date_created', 'last_activity', 'total_member_count', 670 * 'name', 'random'. Default: 'date_created'. 671 * @type string $order Optional. Sort order. 'ASC' or 'DESC'. 672 * Default: 'DESC'. 673 * @type int $per_page Optional. Number of items to return per page 674 * of results. Default: null (no limit). 675 * @type int $page Optional. Page offset of results to return. 676 * Default: null (no limit). 677 * @type int $user_id Optional. If provided, results will be limited to groups 678 * of which the specified user is a member. Default: null. 679 * @type string $search_terms Optional. If provided, only groups whose names 680 * or descriptions match the search terms will be 681 * returned. Default: false. 682 * @type array $meta_query Optional. An array of meta_query conditions. 683 * See {@link WP_Meta_Query::queries} for description. 684 * @type array|string $value Optional. Array or comma-separated list of group IDs. 685 * Results will be limited to groups within the 686 * list. Default: false. 687 * @type bool $populate_extras Whether to fetch additional information 688 * (such as member count) about groups. Default: true. 689 * @type array|string $exclude Optional. Array or comma-separated list of group IDs. 690 * Results will exclude the listed groups. Default: false. 691 * @type bool $update_meta_cache Whether to pre-fetch groupmeta for 692 * the returned groups. Default: true. 693 * @type bool $show_hidden Whether to include hidden groups in results. Default: false. 692 694 * } 693 695 * @return array { 694 696 * @type array $groups Array of group objects returned by the 695 * paginated query.696 * @type int $totalTotal count of all groups matching non-697 * paginated query params.697 * paginated query. 698 * @type int $total Total count of all groups matching non- 699 * paginated query params. 698 700 * } 699 701 */ … … 953 955 * 954 956 * @param array $meta_query An array of meta_query filters. See the 955 * documentation for {@link WP_Meta_Query} for details. 957 * documentation for {@link WP_Meta_Query} for details. 958 * 956 959 * @return array $sql_array 'join' and 'where' clauses. 957 960 */ … … 1000 1003 * 1001 1004 * @param string $type The 'type' shorthand param. 1005 * 1002 1006 * @return array { 1003 * @type string $order SQL-friendly order string.1007 * @type string $order SQL-friendly order string. 1004 1008 * @type string $orderby SQL-friendly orderby column name. 1005 1009 * } … … 1039 1043 1040 1044 /** 1041 * Convert the 'orderby' param into a proper SQL term/column.1042 *1043 * @since BuddyPress (1.8.0)1044 * @access protected1045 *1046 * @param string $orderby Orderby term as passed to get().1047 * @return string $order_by_term SQL-friendly orderby term.1048 */1049 protected static function convert_orderby_to_order_by_term( $orderby ) {1050 $order_by_term = '';1051 1052 switch ( $orderby ) {1053 case 'date_created' :1054 default :1055 $order_by_term = 'g.date_created';1056 break;1057 1058 case 'last_activity' :1059 $order_by_term = 'last_activity';1060 break;1061 1062 case 'total_member_count' :1063 $order_by_term = 'CONVERT(gm1.meta_value, SIGNED)';1064 break;1065 1066 case 'name' :1067 $order_by_term = 'g.name';1068 break;1069 1070 case 'random' :1071 $order_by_term = 'rand()';1072 break;1073 }1074 1075 return $order_by_term;1076 }1077 1078 /**1079 1045 * Get a list of groups, sorted by those that have the most legacy forum topics. 1080 1046 * 1081 * @param int|null $limit Optional. The max number of results to return. 1082 * Default: null (no limit). 1083 * @param int|null $page Optional. The page offset of results to return. 1084 * Default: null (no limit). 1085 * @param int $user_id Optional. If present, groups will be limited to 1086 * those of which the specified user is a member. 1087 * @param string|bool $search_terms Optional. Limit groups to those whose 1088 * name or description field contain the search string. 1089 * @param bool $populate_extras Optional. Whether to fetch extra 1090 * information about the groups. Default: true. 1091 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1092 * IDs to exclude from results. 1047 * @param int|null $limit Optional. The max number of results to return. 1048 * Default: null (no limit). 1049 * @param int|null $page Optional. The page offset of results to return. 1050 * Default: null (no limit). 1051 * @param int $user_id Optional. If present, groups will be limited to 1052 * those of which the specified user is a member. 1053 * @param string|bool $search_terms Optional. Limit groups to those whose name 1054 * or description field contain the search string. 1055 * @param bool $populate_extras Optional. Whether to fetch extra 1056 * information about the groups. Default: true. 1057 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1058 * IDs to exclude from results. 1059 * 1093 1060 * @return array { 1094 1061 * @type array $groups Array of group objects returned by the 1095 * paginated query.1096 * @type int $totalTotal count of all groups matching non-1097 * paginated query params.1062 * paginated query. 1063 * @type int $total Total count of all groups matching non- 1064 * paginated query params. 1098 1065 * } 1099 1066 */ … … 1146 1113 1147 1114 /** 1115 * Convert the 'orderby' param into a proper SQL term/column. 1116 * 1117 * @since BuddyPress (1.8.0) 1118 * @access protected 1119 * 1120 * @param string $orderby Orderby term as passed to get(). 1121 * 1122 * @return string $order_by_term SQL-friendly orderby term. 1123 */ 1124 protected static function convert_orderby_to_order_by_term( $orderby ) { 1125 $order_by_term = ''; 1126 1127 switch ( $orderby ) { 1128 case 'date_created' : 1129 default : 1130 $order_by_term = 'g.date_created'; 1131 break; 1132 1133 case 'last_activity' : 1134 $order_by_term = 'last_activity'; 1135 break; 1136 1137 case 'total_member_count' : 1138 $order_by_term = 'CONVERT(gm1.meta_value, SIGNED)'; 1139 break; 1140 1141 case 'name' : 1142 $order_by_term = 'g.name'; 1143 break; 1144 1145 case 'random' : 1146 $order_by_term = 'rand()'; 1147 break; 1148 } 1149 1150 return $order_by_term; 1151 } 1152 1153 /** 1148 1154 * Get a list of groups, sorted by those that have the most legacy forum posts. 1149 1155 * 1150 * @param int|null $limit Optional. The max number of results to return. 1151 * Default: null (no limit). 1152 * @param int|null $page Optional. The page offset of results to return. 1153 * Default: null (no limit). 1154 * @param string|bool $search_terms Optional. Limit groups to those whose 1155 * name or description field contain the search string. 1156 * @param bool $populate_extras Optional. Whether to fetch extra 1157 * information about the groups. Default: true. 1158 * @param string|array|bool Optional. Array or comma-separated list of group 1159 * IDs to exclude from results. 1156 * @param int|null $limit Optional. The max number of results to return. 1157 * Default: null (no limit). 1158 * @param int|null $page Optional. The page offset of results to return. 1159 * Default: null (no limit). 1160 * @param string|bool $search_terms Optional. Limit groups to those whose name 1161 * or description field contain the search string. 1162 * @param bool $populate_extras Optional. Whether to fetch extra 1163 * information about the groups. Default: true. 1164 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1165 * IDs to exclude from results. 1166 * 1160 1167 * @return array { 1161 1168 * @type array $groups Array of group objects returned by the 1162 * paginated query.1163 * @type int $totalTotal count of all groups matching non-1164 * paginated query params.1169 * paginated query. 1170 * @type int $total Total count of all groups matching non- 1171 * paginated query params. 1165 1172 * } 1166 1173 */ … … 1215 1222 * Get a list of groups whose names start with a given letter. 1216 1223 * 1217 * @param string $letterThe letter.1218 * @param int|null $limitOptional. The max number of results to return.1219 * Default: null (no limit).1220 * @param int|null $pageOptional. The page offset of results to return.1221 * Default: null (no limit).1222 * @param bool $populate_extras Optional. Whether to fetch extra1223 * information about the groups. Default: true.1224 * @param string|array|bool $exclude Optional. Array or comma-separated list of group1225 * IDs to exclude from results.1224 * @param string $letter The letter. 1225 * @param int|null $limit Optional. The max number of results to return. 1226 * Default: null (no limit). 1227 * @param int|null $page Optional. The page offset of results to return. 1228 * Default: null (no limit). 1229 * @param bool $populate_extras Optional. Whether to fetch extra 1230 * information about the groups. Default: true. 1231 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1232 * IDs to exclude from results. 1226 1233 * @return false|array { 1227 1234 * @type array $groups Array of group objects returned by the 1228 * paginated query.1229 * @type int $totalTotal count of all groups matching non-1230 * paginated query params.1235 * paginated query. 1236 * @type int $total Total count of all groups matching non- 1237 * paginated query params. 1231 1238 * } 1232 1239 */ … … 1282 1289 * Use BP_Groups_Group::get() with 'type' = 'random' instead. 1283 1290 * 1284 * @param int|null $limit Optional. The max number of results to return. 1285 * Default: null (no limit). 1286 * @param int|null $page Optional. The page offset of results to return. 1287 * Default: null (no limit). 1288 * @param int $user_id Optional. If present, groups will be limited to 1289 * those of which the specified user is a member. 1290 * @param string|bool $search_terms Optional. Limit groups to those whose 1291 * name or description field contain the search string. 1292 * @param bool $populate_extras Optional. Whether to fetch extra 1293 * information about the groups. Default: true. 1294 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1295 * IDs to exclude from results. 1291 * @param int|null $limit Optional. The max number of results to return. 1292 * Default: null (no limit). 1293 * @param int|null $page Optional. The page offset of results to return. 1294 * Default: null (no limit). 1295 * @param int $user_id Optional. If present, groups will be limited to 1296 * those of which the specified user is a member. 1297 * @param string|bool $search_terms Optional. Limit groups to those whose name 1298 * or description field contain the search string. 1299 * @param bool $populate_extras Optional. Whether to fetch extra 1300 * information about the groups. Default: true. 1301 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1302 * IDs to exclude from results. 1303 * 1296 1304 * @return array { 1297 1305 * @type array $groups Array of group objects returned by the 1298 * paginated query.1299 * @type int $totalTotal count of all groups matching non-1300 * paginated query params.1306 * paginated query. 1307 * @type int $total Total count of all groups matching non- 1308 * paginated query params. 1301 1309 * } 1302 1310 */ … … 1355 1363 * is_confirmed, is_pending, is_banned) 1356 1364 * 1357 * @param array $paged_groups Array of groups. 1358 * @param string|array Array or comma-separated list of IDs matching 1359 * $paged_groups. 1360 * @param string|bool $type Not used. 1365 * @param array $paged_groups Array of groups. 1366 * @param string|array $group_ids Array or comma-separated list of IDs matching 1367 * $paged_groups. 1368 * @param string|bool $type Not used. 1369 * 1361 1370 * @return array $paged_groups 1362 1371 */ … … 1432 1441 * Delete all invitations to a given group. 1433 1442 * 1434 * @param int $group_id ID of the group whose invitations are being 1435 * deleted.1443 * @param int $group_id ID of the group whose invitations are being deleted. 1444 * 1436 1445 * @return int|null Number of rows records deleted on success, null on 1437 * failure.1446 * failure. 1438 1447 */ 1439 1448 public static function delete_all_invites( $group_id ) { … … 1469 1478 * 1470 1479 * @param string $type Optional. If 'unreplied', count will be limited to 1471 * those topics that have received no replies. 1480 * those topics that have received no replies. 1481 * 1472 1482 * @return int Forum topic count. 1473 1483 */ … … 1503 1513 * 1504 1514 * @param int $group_id Group ID. 1515 * 1505 1516 * @return int Count of confirmed members for the group. 1506 1517 */ … … 1514 1525 1515 1526 /** 1516 * Get a total count of all topics of a given status, across groups/forums 1527 * Get a total count of all topics of a given status, across groups/forums. 1517 1528 * 1518 1529 * @since BuddyPress (1.5.0) 1519 1530 * 1520 * @param string $statusWhich group type to count. 'public', 'private',1521 * 'hidden', or 'all'. Default: 'public'.1531 * @param string $status Which group type to count. 'public', 'private', 1532 * 'hidden', or 'all'. Default: 'public'. 1522 1533 * @param string|bool $search_terms Provided search terms. 1523 1534 * -
trunk/src/bp-groups/classes/class-bp-groups-member.php
r9906 r9982 1 1 <?php 2 2 /** 3 * BuddyPress Groups Classes 3 * BuddyPress Groups Classes. 4 4 * 5 5 * @package BuddyPress … … 134 134 * Constructor method. 135 135 * 136 * @param int $user_idOptional. Along with $group_id, can be used to137 * look up a membership.138 * @param int $group_id Optional. Along with $user_id, can be used to139 * look up a membership.140 * @param int|bool $id Optional. The unique ID of the membership object.141 * @param bool $populate Whether to populate the properties of the142 * located membership. Default: true.136 * @param int $user_id Optional. Along with $group_id, can be used to 137 * look up a membership. 138 * @param int $group_id Optional. Along with $user_id, can be used to 139 * look up a membership. 140 * @param int|bool $id Optional. The unique ID of the membership object. 141 * @param bool $populate Whether to populate the properties of the 142 * located membership. Default: true. 143 143 */ 144 144 public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) { … … 271 271 * 272 272 * @param string $status The new status. 'mod' or 'admin'. 273 * 273 274 * @return bool True on success, false on failure. 274 275 */ … … 397 398 * 398 399 * @param int $user_id ID of the user. 400 * 399 401 * @return bool True on success, false on failure. 400 402 */ … … 409 411 * 410 412 * @param int $group_id ID of the group. 413 * 411 414 * @return bool True on success, false on failure. 412 415 */ … … 418 421 * Delete a membership, based on user + group IDs. 419 422 * 420 * @param int $user_id ID of the user. 421 * @param int $group_id ID of the group. 423 * @param int $user_id ID of the user. 424 * @param int $group_id ID of the group. 425 * 422 426 * @return True on success, false on failure. 423 427 */ … … 460 464 * Get the IDs of the groups of which a specified user is a member. 461 465 * 462 * @param int $user_id ID of the user.463 * @param int|bool $limit Optional. Max number of results to return.464 * Default: false (no limit).465 * @param int|bool $page Optional. Page offset of results to return.466 * Default: false (no limit).466 * @param int $user_id ID of the user. 467 * @param int|bool $limit Optional. Max number of results to return. 468 * Default: false (no limit). 469 * @param int|bool $page Optional. Page offset of results to return. 470 * Default: false (no limit). 467 471 * @return array { 468 472 * @type array $groups Array of groups returned by paginated query. 469 * @type int $totalCount of groups matching query.473 * @type int $total Count of groups matching query. 470 474 * } 471 475 */ … … 496 500 * Get the IDs of the groups of which a specified user is a member, sorted by the date joined. 497 501 * 498 * @param int $user_id ID of the user.499 * @param int|bool $limitOptional. Max number of results to return.500 * Default: false (no limit).501 * @param int|bool $pageOptional. Page offset of results to return.502 * Default: false (no limit).503 * @param string|bool $filter Optional. Limit results to groups whose name or504 * description field matches search terms.502 * @param int $user_id ID of the user. 503 * @param int|bool $limit Optional. Max number of results to return. 504 * Default: false (no limit). 505 * @param int|bool $page Optional. Page offset of results to return. 506 * Default: false (no limit). 507 * @param string|bool $filter Optional. Limit results to groups whose name or 508 * description field matches search terms. 505 509 * @return array { 506 510 * @type array $groups Array of groups returned by paginated query. 507 * @type int $totalCount of groups matching query.511 * @type int $total Count of groups matching query. 508 512 * } 509 513 */ … … 537 541 * Get the IDs of the groups of which a specified user is an admin. 538 542 * 539 * @param int $user_id ID of the user. 540 * @param int|bool $limit Optional. Max number of results to return. 541 * Default: false (no limit). 542 * @param int|bool $page Optional. Page offset of results to return. 543 * Default: false (no limit). 544 * @param string|bool $filter Optional. Limit results to groups whose name or 545 * description field matches search terms. 543 * @param int $user_id ID of the user. 544 * @param int|bool $limit Optional. Max number of results to return. 545 * Default: false (no limit). 546 * @param int|bool $page Optional. Page offset of results to return. 547 * Default: false (no limit). 548 * @param string|bool $filter Optional. Limit results to groups whose name or 549 * description field matches search terms. 550 * 546 551 * @return array { 547 552 * @type array $groups Array of groups returned by paginated query. 548 * @type int $totalCount of groups matching query.553 * @type int $total Count of groups matching query. 549 554 * } 550 555 */ … … 578 583 * Get the IDs of the groups of which a specified user is a moderator. 579 584 * 580 * @param int $user_id ID of the user. 581 * @param int|bool $limit Optional. Max number of results to return. 582 * Default: false (no limit). 583 * @param int|bool $page Optional. Page offset of results to return. 584 * Default: false (no limit). 585 * @param string|bool $filter Optional. Limit results to groups whose name or 586 * description field matches search terms. 585 * @param int $user_id ID of the user. 586 * @param int|bool $limit Optional. Max number of results to return. 587 * Default: false (no limit). 588 * @param int|bool $page Optional. Page offset of results to return. 589 * Default: false (no limit). 590 * @param string|bool $filter Optional. Limit results to groups whose name or 591 * description field matches search terms. 592 * 587 593 * @return array { 588 594 * @type array $groups Array of groups returned by paginated query. 589 * @type int $totalCount of groups matching query.595 * @type int $total Count of groups matching query. 590 596 * } 591 597 */ … … 620 626 * 621 627 * @param int $user_id Optional. Default: ID of the displayed user. 628 * 622 629 * @return int Group count. 623 630 */ … … 640 647 * Get a user's outstanding group invitations. 641 648 * 642 * @param int $user_id ID of the invitee.643 * @param int|bool $limitOptional. Max number of results to return.644 * Default: false (no limit).645 * @param int|bool $pageOptional. Page offset of results to return.646 * Default: false (no limit).649 * @param int $user_id ID of the invitee. 650 * @param int|bool $limit Optional. Max number of results to return. 651 * Default: false (no limit). 652 * @param int|bool $page Optional. Page offset of results to return. 653 * Default: false (no limit). 647 654 * @param string|array|bool $exclude Optional. Array or comma-separated list 648 * of group IDs to exclude from results. 655 * of group IDs to exclude from results. 656 * 649 657 * @return array { 650 658 * @type array $groups Array of groups returned by paginated query. 651 * @type int $totalCount of groups matching query.659 * @type int $total Count of groups matching query. 652 660 * } 653 661 */ … … 676 684 * @since BuddyPress (2.0.0) 677 685 * 678 * @param int $user_id The user ID 686 * @param int $user_id The user ID. 687 * 679 688 * @return int 680 689 */ … … 697 706 * Check whether a user has an outstanding invitation to a given group. 698 707 * 699 * @param int $user_idID of the potential invitee.700 * @param int $group_id ID of the group.701 * @param string $type If 'sent', results are limited to those702 * invitations that have actually been sent (non-draft).703 * Default: 'sent'.708 * @param int $user_id ID of the potential invitee. 709 * @param int $group_id ID of the group. 710 * @param string $type If 'sent', results are limited to those invitations 711 * that have actually been sent (non-draft). Default: 'sent'. 712 * 704 713 * @return int|null The ID of the invitation if found, otherwise null. 705 714 */ … … 726 735 * @param int $user_id ID of the user. 727 736 * @param int $group_id ID of the group. 737 * 728 738 * @return int Number of records deleted. 729 739 */ … … 751 761 * Delete an unconfirmed membership request, by user ID and group ID. 752 762 * 753 * @param int $user_id ID of the user. 754 * @param int $group_id ID of the group. 763 * @param int $user_id ID of the user. 764 * @param int $group_id ID of the group. 765 * 755 766 * @return int Number of records deleted. 756 767 */ … … 769 780 * Check whether a user is an admin of a given group. 770 781 * 771 * @param int $user_id ID of the user. 772 * @param int $group_id ID of the group. 773 * @param int|null ID of the membership if the user is an admin, 774 * otherwise null. 782 * @param int $user_id ID of the user. 783 * @param int $group_id ID of the group. 775 784 * 776 785 * @return mixed … … 790 799 * Check whether a user is a mod of a given group. 791 800 * 792 * @param int $user_id ID of the user. 793 * @param int $group_id ID of the group. 794 * @param int|null ID of the membership if the user is a mod, 795 * otherwise null. 801 * @param int $user_id ID of the user. 802 * @param int $group_id ID of the group. 796 803 * 797 804 * @return mixed … … 811 818 * Check whether a user is a member of a given group. 812 819 * 813 * @param int $user_id ID of the user. 814 * @param int $group_id ID of the group. 815 * @param int|null ID of the membership if the user is a member, 816 * otherwise null. 820 * @param int $user_id ID of the user. 821 * @param int $group_id ID of the group. 817 822 * 818 823 * @return mixed … … 832 837 * Check whether a user is banned from a given group. 833 838 * 834 * @param int $user_id ID of the user. 835 * @param int $group_id ID of the group. 836 * @param int|null ID of the membership if the user is banned, 837 * otherwise null. 839 * @param int $user_id ID of the user. 840 * @param int $group_id ID of the group. 838 841 * 839 842 * @return mixed … … 855 858 * @since BuddyPress (1.2.6) 856 859 * 857 * @param int $user_id ID of the user. 858 * @param int $group_id ID of the group. 860 * @param int $user_id ID of the user. 861 * @param int $group_id ID of the group. 862 * 859 863 * @return int|null ID of the group if the user is the creator, 860 * otherwise false.864 * otherwise false. 861 865 */ 862 866 public static function check_is_creator( $user_id, $group_id ) { … … 874 878 * Check whether a user has an outstanding membership request for a given group. 875 879 * 876 * @param int $user_id ID of the user. 877 * @param int $group_id ID of the group. 880 * @param int $user_id ID of the user. 881 * @param int $group_id ID of the group. 882 * 878 883 * @return int|null ID of the membership if found, otherwise false. 879 884 */ … … 892 897 * Get a list of randomly selected IDs of groups that the member belongs to. 893 898 * 894 * @param int $user_id ID of the user.899 * @param int $user_id ID of the user. 895 900 * @param int $total_groups Max number of group IDs to return. Default: 5. 901 * 896 902 * @return array Group IDs. 897 903 */ … … 913 919 * 914 920 * @param int $group_id ID of the group. 921 * 915 922 * @return array IDs of all group members. 916 923 */ … … 927 934 * 928 935 * @param int $group_id ID of the group. 936 * 929 937 * @return array Info about group admins (user_id + date_modified). 930 938 */ … … 948 956 * 949 957 * @param int $group_id ID of the group. 958 * 950 959 * @return array Info about group mods (user_id + date_modified). 951 960 */ … … 962 971 * 963 972 * @param int $group_id ID of the group. 973 * 964 974 * @return array IDs of users with outstanding membership requests. 965 975 */ … … 1069 1079 * 1070 1080 * @param int $group_id ID of the group. 1081 * 1071 1082 * @return int Number of records deleted. 1072 1083 */
Note: See TracChangeset
for help on using the changeset viewer.