diff --git a/src/bp-groups/bp-groups-activity.php b/src/bp-groups/bp-groups-activity.php
index 93be3ef74..b771cd90e 100644
|
a
|
b
|
function groups_record_activity( $args = '' ) { |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | | $r = wp_parse_args( $args, array( |
| | 342 | $r = bp_parse_args( $args, array( |
| 343 | 343 | 'id' => false, |
| 344 | 344 | 'user_id' => bp_loggedin_user_id(), |
| 345 | 345 | 'action' => '', |
| … |
… |
function groups_record_activity( $args = '' ) { |
| 352 | 352 | 'recorded_time' => bp_core_current_time(), |
| 353 | 353 | 'hide_sitewide' => $hide_sitewide, |
| 354 | 354 | 'error_type' => 'bool' |
| 355 | | ) ); |
| | 355 | ), 'groups_record_activity' ); |
| 356 | 356 | |
| 357 | 357 | return bp_activity_add( $r ); |
| 358 | 358 | } |
diff --git a/src/bp-groups/bp-groups-functions.php b/src/bp-groups/bp-groups-functions.php
index edcdb538d..7ed75532f 100644
|
a
|
b
|
function groups_get_group( $group_id ) { |
| 48 | 48 | * Old-style arguments take the form of an array or a query string. |
| 49 | 49 | */ |
| 50 | 50 | if ( ! is_numeric( $group_id ) ) { |
| 51 | | $r = wp_parse_args( $group_id, array( |
| | 51 | $r = bp_parse_args( $group_id, array( |
| 52 | 52 | 'group_id' => false, |
| 53 | 53 | 'load_users' => false, |
| 54 | 54 | 'populate_extras' => false, |
| 55 | | ) ); |
| | 55 | ), 'groups_get_group' ); |
| 56 | 56 | |
| 57 | 57 | $group_id = $r['group_id']; |
| 58 | 58 | } |
| … |
… |
function groups_get_group( $group_id ) { |
| 97 | 97 | */ |
| 98 | 98 | function groups_create_group( $args = '' ) { |
| 99 | 99 | |
| 100 | | $defaults = array( |
| | 100 | $args = bp_parse_args( $args, array( |
| 101 | 101 | 'group_id' => 0, |
| 102 | 102 | 'creator_id' => 0, |
| 103 | 103 | 'name' => '', |
| … |
… |
function groups_create_group( $args = '' ) { |
| 107 | 107 | 'parent_id' => null, |
| 108 | 108 | 'enable_forum' => null, |
| 109 | 109 | 'date_created' => null |
| 110 | | ); |
| | 110 | ), 'groups_create_group' ); |
| 111 | 111 | |
| 112 | | $args = wp_parse_args( $args, $defaults ); |
| 113 | 112 | extract( $args, EXTR_SKIP ); |
| 114 | 113 | |
| 115 | 114 | // Pass an existing group ID. |
| … |
… |
function groups_edit_base_group_details( $args = array() ) { |
| 255 | 254 | $args = bp_core_parse_args_array( $old_args_keys, func_get_args() ); |
| 256 | 255 | } |
| 257 | 256 | |
| 258 | | $r = wp_parse_args( $args, array( |
| | 257 | $r = bp_parse_args( $args, array( |
| 259 | 258 | 'group_id' => bp_get_current_group_id(), |
| 260 | 259 | 'name' => null, |
| 261 | 260 | 'slug' => null, |
| 262 | 261 | 'description' => null, |
| 263 | 262 | 'notify_members' => false, |
| 264 | | ) ); |
| | 263 | ), 'groups_edit_base_group_details' ); |
| 265 | 264 | |
| 266 | 265 | if ( ! $r['group_id'] ) { |
| 267 | 266 | return false; |
| … |
… |
function groups_get_group_members( $args = array() ) { |
| 681 | 680 | $args = bp_core_parse_args_array( $old_args_keys, func_get_args() ); |
| 682 | 681 | } |
| 683 | 682 | |
| 684 | | $r = wp_parse_args( $args, array( |
| | 683 | $r = bp_parse_args( $args, array( |
| 685 | 684 | 'group_id' => bp_get_current_group_id(), |
| 686 | 685 | 'per_page' => false, |
| 687 | 686 | 'page' => false, |
| … |
… |
function groups_get_group_members( $args = array() ) { |
| 691 | 690 | 'group_role' => array(), |
| 692 | 691 | 'search_terms' => false, |
| 693 | 692 | 'type' => 'last_joined', |
| 694 | | ) ); |
| | 693 | ), 'groups_get_group_members' ); |
| 695 | 694 | |
| 696 | 695 | // For legacy users. Use of BP_Groups_Member::get_all_for_group() is deprecated. |
| 697 | 696 | if ( apply_filters( 'bp_use_legacy_group_member_query', false, __FUNCTION__, func_get_args() ) ) { |
| … |
… |
function groups_post_update( $args = '' ) { |
| 1265 | 1264 | |
| 1266 | 1265 | $bp = buddypress(); |
| 1267 | 1266 | |
| 1268 | | $defaults = array( |
| | 1267 | $r = bp_parse_args( $args, array( |
| 1269 | 1268 | 'content' => false, |
| 1270 | 1269 | 'user_id' => bp_loggedin_user_id(), |
| 1271 | 1270 | 'group_id' => 0, |
| 1272 | 1271 | 'error_type' => 'bool' |
| 1273 | | ); |
| 1274 | | |
| 1275 | | $r = wp_parse_args( $args, $defaults ); |
| | 1272 | ), 'groups_post_update' ); |
| 1276 | 1273 | extract( $r, EXTR_SKIP ); |
| 1277 | 1274 | |
| 1278 | 1275 | if ( empty( $group_id ) && !empty( $bp->groups->current_group->id ) ) |
| … |
… |
function groups_get_invite_count_for_user( $user_id = 0 ) { |
| 1394 | 1391 | */ |
| 1395 | 1392 | function groups_invite_user( $args = '' ) { |
| 1396 | 1393 | |
| 1397 | | $defaults = array( |
| | 1394 | $args = bp_parse_args( $args, array( |
| 1398 | 1395 | 'user_id' => false, |
| 1399 | 1396 | 'group_id' => false, |
| 1400 | 1397 | 'inviter_id' => bp_loggedin_user_id(), |
| 1401 | 1398 | 'date_modified' => bp_core_current_time(), |
| 1402 | 1399 | 'is_confirmed' => 0 |
| 1403 | | ); |
| 1404 | | |
| 1405 | | $args = wp_parse_args( $args, $defaults ); |
| | 1400 | ), 'groups_invite_user' ); |
| 1406 | 1401 | extract( $args, EXTR_SKIP ); |
| 1407 | 1402 | |
| 1408 | 1403 | if ( ! $user_id || ! $group_id || ! $inviter_id ) { |
diff --git a/src/bp-groups/bp-groups-template.php b/src/bp-groups/bp-groups-template.php
index a68967718..ab0591ec1 100644
|
a
|
b
|
function bp_group_last_active( $group = false, $args = array() ) { |
| 921 | 921 | $group =& $groups_template->group; |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | | $r = wp_parse_args( $args, array( |
| | 924 | $r = bp_parse_args( $args, array( |
| 925 | 925 | 'relative' => true, |
| 926 | | ) ); |
| | 926 | ), 'group_last_active' ); |
| 927 | 927 | |
| 928 | 928 | $last_active = $group->last_activity; |
| 929 | 929 | if ( ! $last_active ) { |
| … |
… |
function bp_group_date_created( $group = false, $args = array() ) { |
| 1349 | 1349 | function bp_get_group_date_created( $group = false, $args = array() ) { |
| 1350 | 1350 | global $groups_template; |
| 1351 | 1351 | |
| 1352 | | $r = wp_parse_args( $args, array( |
| | 1352 | $r = bp_parse_args( $args, array( |
| 1353 | 1353 | 'relative' => true, |
| 1354 | | ) ); |
| | 1354 | ), 'group_date_created' ); |
| 1355 | 1355 | |
| 1356 | 1356 | if ( empty( $group ) ) { |
| 1357 | 1357 | $group =& $groups_template->group; |
| … |
… |
function bp_group_creator_avatar( $group = false, $args = array() ) { |
| 1557 | 1557 | $group =& $groups_template->group; |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | | $defaults = array( |
| | 1560 | $r = bp_parse_args( $args, array( |
| 1561 | 1561 | 'type' => 'full', |
| 1562 | 1562 | 'width' => false, |
| 1563 | 1563 | 'height' => false, |
| 1564 | 1564 | 'class' => 'avatar', |
| 1565 | 1565 | 'id' => false, |
| 1566 | 1566 | 'alt' => sprintf( __( 'Group creator profile photo of %s', 'buddypress' ), bp_core_get_user_displayname( $group->creator_id ) ) |
| 1567 | | ); |
| 1568 | | |
| 1569 | | $r = wp_parse_args( $args, $defaults ); |
| | 1567 | ), 'group_creator_avatar' ); |
| 1570 | 1568 | extract( $r, EXTR_SKIP ); |
| 1571 | 1569 | |
| 1572 | 1570 | $avatar = bp_core_fetch_avatar( array( 'item_id' => $group->creator_id, 'type' => $type, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'alt' => $alt ) ); |
| … |
… |
function bp_group_member_promote_mod_link( $args = '' ) { |
| 2444 | 2442 | function bp_get_group_member_promote_mod_link( $args = '' ) { |
| 2445 | 2443 | global $members_template, $groups_template; |
| 2446 | 2444 | |
| 2447 | | $defaults = array( |
| | 2445 | $r = bp_parse_args( $args, array( |
| 2448 | 2446 | 'user_id' => $members_template->member->user_id, |
| 2449 | 2447 | 'group' => &$groups_template->group |
| 2450 | | ); |
| 2451 | | |
| 2452 | | $r = wp_parse_args( $args, $defaults ); |
| | 2448 | ), 'group_member_promote_mod_link' ); |
| 2453 | 2449 | extract( $r, EXTR_SKIP ); |
| 2454 | 2450 | |
| 2455 | 2451 | /** |
| … |
… |
function bp_group_member_promote_admin_link( $args = '' ) { |
| 2487 | 2483 | function bp_get_group_member_promote_admin_link( $args = '' ) { |
| 2488 | 2484 | global $members_template, $groups_template; |
| 2489 | 2485 | |
| 2490 | | $defaults = array( |
| | 2486 | $r = bp_parse_args( $args, array( |
| 2491 | 2487 | 'user_id' => !empty( $members_template->member->user_id ) ? $members_template->member->user_id : false, |
| 2492 | 2488 | 'group' => &$groups_template->group |
| 2493 | | ); |
| 2494 | | |
| 2495 | | $r = wp_parse_args( $args, $defaults ); |
| | 2489 | ), 'group_member_promote_admin_link' ); |
| 2496 | 2490 | extract( $r, EXTR_SKIP ); |
| 2497 | 2491 | |
| 2498 | 2492 | /** |
| … |
… |
function bp_group_has_members( $args = '' ) { |
| 3696 | 3690 | $search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] ); |
| 3697 | 3691 | } |
| 3698 | 3692 | |
| 3699 | | $r = wp_parse_args( $args, array( |
| | 3693 | $r = bp_parse_args( $args, array( |
| 3700 | 3694 | 'group_id' => bp_get_current_group_id(), |
| 3701 | 3695 | 'page' => 1, |
| 3702 | 3696 | 'per_page' => 20, |
| … |
… |
function bp_group_has_members( $args = '' ) { |
| 3707 | 3701 | 'group_role' => false, |
| 3708 | 3702 | 'search_terms' => $search_terms_default, |
| 3709 | 3703 | 'type' => 'last_joined', |
| 3710 | | ) ); |
| | 3704 | ), 'group_has_members' ); |
| 3711 | 3705 | |
| 3712 | 3706 | /* |
| 3713 | 3707 | * If an empty search_terms string has been passed, |
| … |
… |
function bp_group_member_joined_since( $args = array() ) { |
| 4082 | 4076 | function bp_get_group_member_joined_since( $args = array() ) { |
| 4083 | 4077 | global $members_template; |
| 4084 | 4078 | |
| 4085 | | $r = wp_parse_args( $args, array( |
| | 4079 | $r = bp_parse_args( $args, array( |
| 4086 | 4080 | 'relative' => true, |
| 4087 | | ) ); |
| | 4081 | ), 'group_member_joined_since' ); |
| 4088 | 4082 | |
| 4089 | 4083 | // We do not want relative time, so return now. |
| 4090 | 4084 | // @todo Should the 'bp_get_group_member_joined_since' filter be applied here? |
| … |
… |
function bp_new_group_invite_friend_list( $args = array() ) { |
| 5021 | 5015 | } |
| 5022 | 5016 | |
| 5023 | 5017 | // Parse arguments. |
| 5024 | | $r = wp_parse_args( $args, array( |
| | 5018 | $r = bp_parse_args( $args, array( |
| 5025 | 5019 | 'user_id' => bp_loggedin_user_id(), |
| 5026 | 5020 | 'group_id' => false, |
| 5027 | 5021 | 'separator' => 'li' |
| 5028 | | ) ); |
| | 5022 | ), 'group_invite_friend_list' ); |
| 5029 | 5023 | |
| 5030 | 5024 | // No group passed, so look for new or current group ID's. |
| 5031 | 5025 | if ( empty( $r['group_id'] ) ) { |
| … |
… |
function bp_custom_group_fields() { |
| 5373 | 5367 | function bp_group_has_membership_requests( $args = '' ) { |
| 5374 | 5368 | global $requests_template; |
| 5375 | 5369 | |
| 5376 | | $defaults = array( |
| | 5370 | $r = bp_parse_args( $args, array( |
| 5377 | 5371 | 'group_id' => bp_get_current_group_id(), |
| 5378 | 5372 | 'per_page' => 10, |
| 5379 | 5373 | 'page' => 1, |
| 5380 | 5374 | 'max' => false |
| 5381 | | ); |
| 5382 | | |
| 5383 | | $r = wp_parse_args( $args, $defaults ); |
| | 5375 | ), 'group_has_membership_requests' ); |
| 5384 | 5376 | |
| 5385 | 5377 | $requests_template = new BP_Groups_Membership_Requests_Template( $r ); |
| 5386 | 5378 | |
| … |
… |
function bp_group_requests_pagination_count() { |
| 5622 | 5614 | function bp_group_has_invites( $args = '' ) { |
| 5623 | 5615 | global $invites_template, $group_id; |
| 5624 | 5616 | |
| 5625 | | $r = wp_parse_args( $args, array( |
| | 5617 | $r = bp_parse_args( $args, array( |
| 5626 | 5618 | 'group_id' => false, |
| 5627 | 5619 | 'user_id' => bp_loggedin_user_id(), |
| 5628 | 5620 | 'per_page' => false, |
| 5629 | 5621 | 'page' => 1, |
| 5630 | | ) ); |
| | 5622 | ), 'group_has_invites' ); |
| 5631 | 5623 | |
| 5632 | 5624 | if ( empty( $r['group_id'] ) ) { |
| 5633 | 5625 | if ( groups_get_current_group() ) { |
diff --git a/src/bp-groups/classes/class-bp-group-member-query.php b/src/bp-groups/classes/class-bp-group-member-query.php
index 4bdaf0345..d872810e3 100644
|
a
|
b
|
class BP_Group_Member_Query extends BP_User_Query { |
| 87 | 87 | // We loop through to make sure that defaults are set (though |
| 88 | 88 | // values passed to the constructor will, as usual, override |
| 89 | 89 | // these defaults). |
| 90 | | $this->query_vars = wp_parse_args( $this->query_vars, array( |
| | 90 | $this->query_vars = bp_parse_args( $this->query_vars, array( |
| 91 | 91 | 'group_id' => 0, |
| 92 | 92 | 'group_role' => array( 'member' ), |
| 93 | 93 | 'is_confirmed' => true, |
| 94 | 94 | 'invite_sent' => null, |
| 95 | 95 | 'inviter_id' => null, |
| 96 | 96 | 'type' => 'last_joined', |
| 97 | | ) ); |
| | 97 | ), 'bp_group_member_query_get_include_ids' ); |
| 98 | 98 | |
| 99 | 99 | $group_member_ids = $this->get_group_member_ids(); |
| 100 | 100 | |
diff --git a/src/bp-groups/classes/class-bp-groups-group-members-template.php b/src/bp-groups/classes/class-bp-groups-group-members-template.php
index 8b25d7509..78df766b6 100644
|
a
|
b
|
class BP_Groups_Group_Members_Template { |
| 111 | 111 | $args = bp_core_parse_args_array( $old_args_keys, func_get_args() ); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | | $r = wp_parse_args( $args, array( |
| | 114 | $r = bp_parse_args( $args, array( |
| 115 | 115 | 'group_id' => bp_get_current_group_id(), |
| 116 | 116 | 'page' => 1, |
| 117 | 117 | 'per_page' => 20, |
| … |
… |
class BP_Groups_Group_Members_Template { |
| 123 | 123 | 'group_role' => false, |
| 124 | 124 | 'search_terms' => false, |
| 125 | 125 | 'type' => 'last_joined', |
| 126 | | ) ); |
| | 126 | ), 'group_members_template' ); |
| 127 | 127 | |
| 128 | 128 | $this->pag_arg = sanitize_key( $r['page_arg'] ); |
| 129 | 129 | $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page'] ); |
diff --git a/src/bp-groups/classes/class-bp-groups-group.php b/src/bp-groups/classes/class-bp-groups-group.php
index 795404495..0add64940 100644
|
a
|
b
|
class BP_Groups_Group { |
| 1084 | 1084 | 'fields' => 'all', |
| 1085 | 1085 | ); |
| 1086 | 1086 | |
| 1087 | | $r = wp_parse_args( $args, $defaults ); |
| | 1087 | $r = bp_parse_args( $args, $defaults, 'bp_groups_group_get' ); |
| 1088 | 1088 | |
| 1089 | 1089 | $bp = buddypress(); |
| 1090 | 1090 | |
diff --git a/src/bp-groups/classes/class-bp-groups-invite-template.php b/src/bp-groups/classes/class-bp-groups-invite-template.php
index 6498cd45c..0d16db855 100644
|
a
|
b
|
class BP_Groups_Invite_Template { |
| 91 | 91 | $args = bp_core_parse_args_array( $old_args_keys, func_get_args() ); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | | $r = wp_parse_args( $args, array( |
| | 94 | $r = bp_parse_args( $args, array( |
| 95 | 95 | 'page' => 1, |
| 96 | 96 | 'per_page' => 10, |
| 97 | 97 | 'page_arg' => 'invitepage', |
| 98 | 98 | 'user_id' => bp_loggedin_user_id(), |
| 99 | 99 | 'group_id' => bp_get_current_group_id(), |
| 100 | | ) ); |
| | 100 | ), 'groups_invite_template' ); |
| 101 | 101 | |
| 102 | 102 | $this->pag_arg = sanitize_key( $r['page_arg'] ); |
| 103 | 103 | $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page'] ); |
diff --git a/src/bp-groups/classes/class-bp-groups-membership-requests-template.php b/src/bp-groups/classes/class-bp-groups-membership-requests-template.php
index b0a011a19..a98a18a85 100644
|
a
|
b
|
class BP_Groups_Membership_Requests_Template { |
| 99 | 99 | $args = bp_core_parse_args_array( $old_args_keys, func_get_args() ); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | | $r = wp_parse_args( $args, array( |
| | 102 | $r = bp_parse_args( $args, array( |
| 103 | 103 | 'page' => 1, |
| 104 | 104 | 'per_page' => 10, |
| 105 | 105 | 'page_arg' => 'mrpage', |
| 106 | 106 | 'max' => false, |
| 107 | 107 | 'type' => 'first_joined', |
| 108 | 108 | 'group_id' => bp_get_current_group_id(), |
| 109 | | ) ); |
| | 109 | ), 'groups_membership_requests_template' ); |
| 110 | 110 | |
| 111 | 111 | $this->pag_arg = sanitize_key( $r['page_arg'] ); |
| 112 | 112 | $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page'] ); |
diff --git a/src/bp-groups/classes/class-bp-groups-template.php b/src/bp-groups/classes/class-bp-groups-template.php
index ba5e41284..bb14a840e 100644
|
a
|
b
|
class BP_Groups_Template { |
| 175 | 175 | 'update_admin_cache' => false, |
| 176 | 176 | ); |
| 177 | 177 | |
| 178 | | $r = wp_parse_args( $args, $defaults ); |
| | 178 | $r = bp_parse_args( $args, $defaults, 'groups_template' ); |
| 179 | 179 | extract( $r ); |
| 180 | 180 | |
| 181 | 181 | $this->pag_arg = sanitize_key( $r['page_arg'] ); |
diff --git a/src/bp-groups/classes/class-bp-groups-widget.php b/src/bp-groups/classes/class-bp-groups-widget.php
index 049ab3127..d18301fb4 100644
|
a
|
b
|
class BP_Groups_Widget extends WP_Widget { |
| 206 | 206 | 'group_default' => 'active', |
| 207 | 207 | 'link_title' => false |
| 208 | 208 | ); |
| 209 | | $instance = wp_parse_args( (array) $instance, $defaults ); |
| | 209 | $instance = bp_parse_args( (array) $instance, $defaults, 'groups_widget_form' ); |
| 210 | 210 | |
| 211 | 211 | $title = strip_tags( $instance['title'] ); |
| 212 | 212 | $max_groups = strip_tags( $instance['max_groups'] ); |