Changeset 10373 for trunk/src/bp-groups/bp-groups-activity.php
- Timestamp:
- 11/22/2015 04:58:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-activity.php
r10148 r10373 54 54 // These actions are for the legacy forums 55 55 // Since the bbPress plugin also shares the same 'forums' identifier, we also 56 // check for the legacy forums loader class to be extra cautious 56 // check for the legacy forums loader class to be extra cautious. 57 57 if ( bp_is_active( 'forums' ) && class_exists( 'BP_Forums_Component' ) ) { 58 58 bp_activity_set_action( … … 91 91 * @param string $action Static activity action. 92 92 * @param object $activity Activity data object. 93 *94 93 * @return string 95 94 */ … … 123 122 * @param string $action Static activity action. 124 123 * @param object $activity Activity data object. 125 *126 124 * @return string 127 125 */ … … 138 136 139 137 // Legacy filters (do not follow parameter patterns of other activity 140 // action filters, and requires apply_filters_ref_array()) 138 // action filters, and requires apply_filters_ref_array()). 141 139 if ( has_filter( 'groups_activity_membership_accepted_action' ) ) { 142 140 $action = apply_filters_ref_array( 'groups_activity_membership_accepted_action', array( $action, $user_link, &$group ) ); 143 141 } 144 142 145 // Another legacy filter 143 // Another legacy filter. 146 144 if ( has_filter( 'groups_activity_accepted_invite_action' ) ) { 147 145 $action = apply_filters_ref_array( 'groups_activity_accepted_invite_action', array( $action, $activity->user_id, &$group ) ); … … 166 164 * @param string $action Static activity action. 167 165 * @param object $activity Activity data object. 168 *169 166 * @return string 170 167 */ … … 221 218 * 222 219 * @param array $activities Array of activity items. 223 *224 220 * @return array 225 221 */ … … 243 239 // TEMPORARY - Once the 'populate_extras' issue is solved 244 240 // in the groups component, we can do this with groups_get_groups() 245 // rather than manually 241 // rather than manually. 246 242 $uncached_ids = array(); 247 243 foreach ( $group_ids as $group_id ) { … … 271 267 * @since 2.2.0 272 268 * 273 * @param array $retval Empty array by default 274 * @param array $filter Current activity arguments 269 * @param array $retval Empty array by default. 270 * @param array $filter Current activity arguments. 275 271 * 276 272 * @return array … … 278 274 function bp_groups_filter_activity_scope( $retval = array(), $filter = array() ) { 279 275 280 // Determine the user_id 276 // Determine the user_id. 281 277 if ( ! empty( $filter['user_id'] ) ) { 282 278 $user_id = $filter['user_id']; … … 287 283 } 288 284 289 // Determine groups of user 285 // Determine groups of user. 290 286 $groups = groups_get_user_groups( $user_id ); 291 287 if ( empty( $groups['groups'] ) ) { … … 318 314 $show_hidden, 319 315 320 // overrides316 // Overrides. 321 317 'override' => array( 322 318 'filter' => array( 'user_id' => 0 ), … … 355 351 } 356 352 357 // Set the default for hide_sitewide by checking the status of the group 353 // Set the default for hide_sitewide by checking the status of the group. 358 354 $hide_sitewide = false; 359 355 if ( !empty( $args['item_id'] ) ) { … … 391 387 * @param int $group_id Optional. The ID of the group whose last_activity is 392 388 * being updated. Default: the current group's ID. 393 *394 389 * @return bool|null False on failure. 395 390 */ … … 419 414 * @param int $user_id ID of the user joining the group. 420 415 * @param int $group_id ID of the group. 421 *422 416 * @return bool|null False on failure. 423 417 */ 424 418 function bp_groups_membership_accepted_add_activity( $user_id, $group_id ) { 425 419 426 // Bail if Activity is not active 420 // Bail if Activity is not active. 427 421 if ( ! bp_is_active( 'activity' ) ) { 428 422 return false; 429 423 } 430 424 431 // Get the group so we can get it's name 425 // Get the group so we can get it's name. 432 426 $group = groups_get_group( array( 'group_id' => $group_id ) ); 433 427 … … 443 437 $action = apply_filters_ref_array( 'groups_activity_membership_accepted_action', array( sprintf( __( '%1$s joined the group %2$s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $user_id, &$group ) ); 444 438 445 // Record in activity streams 439 // Record in activity streams. 446 440 groups_record_activity( array( 447 441 'action' => $action, … … 461 455 * @param BP_Groups_Group $old_group Group object before the details had been changed. 462 456 * @param bool $notify_members True if the admin has opted to notify group members, otherwise false. 463 *464 457 * @return int|bool The ID of the activity on success. False on error. 465 458 */ … … 475 468 } 476 469 477 // If the admin has opted not to notify members, don't post an activity item either 470 // If the admin has opted not to notify members, don't post an activity item either. 478 471 if ( empty( $notify_members ) ) { 479 472 return; … … 557 550 function bp_groups_leave_group_delete_recent_activity( $group_id, $user_id ) { 558 551 559 // Bail if Activity component is not active 552 // Bail if Activity component is not active. 560 553 if ( ! bp_is_active( 'activity' ) ) { 561 554 return; 562 555 } 563 556 564 // Get the member's group membership information 557 // Get the member's group membership information. 565 558 $membership = new BP_Groups_Member( $user_id, $group_id ); 566 559 567 // Check the time period, and maybe delete their recent group activity 560 // Check the time period, and maybe delete their recent group activity. 568 561 if ( time() <= strtotime( '+5 minutes', (int) strtotime( $membership->date_modified ) ) ) { 569 562 bp_activity_delete( array(
Note: See TracChangeset
for help on using the changeset viewer.