Ticket #5282: 5282.diff
File 5282.diff, 4.5 KB (added by , 11 years ago) |
---|
-
bp-groups/bp-groups-notifications.php
59 59 function groups_notification_new_membership_request( $requesting_user_id, $admin_id, $group_id, $membership_id ) { 60 60 61 61 if ( bp_is_active( 'notifications' ) ) { 62 bp_notifications_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id ); 62 bp_notifications_add_notification( array( 63 'user_id' => $admin_id, 64 'item_id' => $requesting_user_id, 65 'secondary_item_id' => $group_id, 66 'component_name' => buddypress()->groups->id, 67 'component_action' => 'new_membership_request', 68 'date_notified' => bp_core_current_time(), 69 'is_new' => 1, 70 ) ); 63 71 } 64 72 65 73 if ( 'no' == bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) ) … … 110 118 111 119 // Post a screen notification first. 112 120 if ( bp_is_active( 'notifications' ) ) { 113 if ( $accepted ) { 114 bp_notifications_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_accepted' ); 115 } else { 116 bp_notifications_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' ); 117 } 121 122 $type = ! empty( $accepted ) ? 'membership_request_accepted' : 'membership_request_rejected' ; 123 124 bp_notifications_add_notification( array( 125 'user_id' => $requesting_user_id, 126 'item_id' => $group_id, 127 'component_name' => buddypress()->groups->id, 128 'component_action' => $type, 129 'date_notified' => bp_core_current_time(), 130 'is_new' => 1, 131 ) ); 118 132 } 119 133 120 134 if ( 'no' == bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) ) … … 181 195 182 196 // Post a screen notification first. 183 197 if ( bp_is_active( 'notifications' ) ) { 184 bp_notifications_add_notification( $group_id, $user_id, 'groups', $type ); 198 bp_notifications_add_notification( array( 199 'user_id' => $user_id, 200 'item_id' => $group_id, 201 'component_name' => buddypress()->groups->id, 202 'component_action' => $type, 203 'date_notified' => bp_core_current_time(), 204 'is_new' => 1, 205 ) ); 185 206 } 186 207 187 208 if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) ) … … 234 255 235 256 // Post a screen notification first. 236 257 if ( bp_is_active( 'notifications' ) ) { 237 bp_notifications_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' ); 258 bp_notifications_add_notification( array( 259 'user_id' => $invited_user_id, 260 'item_id' => $group->id, 261 'component_name' => buddypress()->groups->id, 262 'component_action' => 'group_invite', 263 'date_notified' => bp_core_current_time(), 264 'is_new' => 1, 265 ) ); 238 266 } 239 267 240 268 if ( 'no' == bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) ) … … 568 596 bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_admin' ); 569 597 } 570 598 } 571 add_action( 'groups_screen_my_groups', 'bp_groups_screen_my_groups_mark_notifications', 10 );572 add_action( 'groups_screen_ home','bp_groups_screen_my_groups_mark_notifications', 10 );599 add_action( 'groups_screen_my_groups', 'bp_groups_screen_my_groups_mark_notifications', 10 ); 600 add_action( 'groups_screen_group_home', 'bp_groups_screen_my_groups_mark_notifications', 10 ); 573 601 574 602 /** 575 603 * Mark group invitation notifications read when a member views their invitations … … 581 609 bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'group_invite' ); 582 610 } 583 611 } 584 add_action( 'groups_screen_ invites', 'bp_groups_screen_invites_mark_notifications', 10 );612 add_action( 'groups_screen_group_invites', 'bp_groups_screen_invites_mark_notifications', 10 ); 585 613 586 614 /** 587 615 * Mark group join requests read when an admin or moderator visits the group … … 592 620 */ 593 621 function bp_groups_screen_group_admin_requests_mark_notifications( $group_id ) { 594 622 if ( bp_is_active( 'notifications' ) ) { 595 bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), $group_id, 'new_membership_request' );623 bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->groups->id, 'new_membership_request' ); 596 624 } 597 625 } 598 626 add_action( 'groups_screen_group_admin_requests', 'bp_groups_screen_group_admin_requests_mark_notifications', 10 );