Changeset 2343 for trunk/bp-groups/bp-groups-notifications.php
- Timestamp:
- 01/18/2010 08:00:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-notifications.php
r2120 r2343 1 1 <?php 2 3 function groups_notification_new_wire_post( $group_id, $wire_post_id ) {4 global $bp;5 6 if ( !isset( $_POST['wire-post-email-notify'] ) )7 return false;8 9 $wire_post = new BP_Wire_Post( $bp->groups->table_name_wire, $wire_post_id );10 $group = new BP_Groups_Group( $group_id, false, true );11 12 $poster_name = bp_core_get_user_displayname( $wire_post->user_id );13 $poster_profile_link = bp_core_get_user_domain( $wire_post->user_id );14 15 $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New wire post on group: %s', 'buddypress' ), stripslashes( attribute_escape( $group->name ) ) );16 17 foreach ( $group->user_dataset as $user ) {18 if ( 'no' == get_usermeta( $user->user_id, 'notification_groups_wire_post' ) ) continue;19 20 $ud = get_userdata( $user->user_id );21 22 // Set up and send the message23 $to = $ud->user_email;24 25 $wire_link = site_url( $bp->groups->slug . '/' . $group->slug . '/wire/' );26 $group_link = site_url( $bp->groups->slug . '/' . $group->slug . '/' );27 $settings_link = bp_core_get_user_domain( $user->user_id ) . 'settings/notifications/';28 29 $message = sprintf( __(30 '%s posted on the wire of the group "%s":31 32 "%s"33 34 To view the group wire: %s35 36 To view the group home: %s37 38 To view %s\'s profile page: %s39 40 ---------------------41 ', 'buddypress' ), $poster_name, stripslashes( attribute_escape( $group->name ) ), stripslashes($wire_post->content), $wire_link, $group_link, $poster_name, $poster_profile_link );42 43 $message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );44 45 // Send it46 wp_mail( $to, $subject, $message );47 48 unset( $message, $to );49 }50 }51 2 52 3 function groups_notification_group_updated( $group_id ) {
Note: See TracChangeset
for help on using the changeset viewer.