Changeset 3515 for branches/plugin/bbp-includes/bbp-common-functions.php
- Timestamp:
- 09/15/2011 08:29:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-common-functions.php
r3505 r3515 983 983 * @return bool True on success, false on failure 984 984 */ 985 function bbp_notify_subscribers( $reply_id = 0 ) {985 function bbp_notify_subscribers( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0 ) { 986 986 global $wpdb; 987 987 … … 990 990 return false; 991 991 992 /** Validation ************************************************************/ 993 $reply_id = bbp_get_reply_id( $reply_id ); 994 $topic_id = bbp_get_topic_id( $topic_id ); 995 $forum_id = bbp_get_reply_id( $forum_id ); 996 992 997 /** Reply *****************************************************************/ 993 994 // Validate reply ID and bail if empty995 $reply_id = bbp_get_reply_id( $reply_id );996 if ( empty( $reply_id ) )997 return false;998 999 // Get the reply and bail if empty1000 $reply = bbp_get_reply( $reply_id );1001 if ( empty( $reply ) )1002 return false;1003 998 1004 999 // Bail if reply is not published … … 1008 1003 /** Topic *****************************************************************/ 1009 1004 1010 // Get topic ID and bail if empty 1011 $topic_id = bbp_get_reply_topic_id( $reply_id ); 1012 if ( empty( $topic_id ) ) 1005 // Bail if topic is not published 1006 if ( !bbp_is_topic_published( $topic_id ) ) 1013 1007 return false; 1014 1008 1015 // Get the topic and bail if empty1016 $topic = bbp_get_topic( $topic_id );1017 if ( empty( $topic ) )1018 return false;1019 1020 // Bail if reply is not published1021 if ( !bbp_is_topic_published( $reply_id ) )1022 return false;1023 1024 1009 /** User ******************************************************************/ 1025 1010 1026 // Get 1011 // Get subscribers and bail if empty 1027 1012 $user_ids = bbp_get_topic_subscribers( $topic_id, true ); 1028 1013 if ( empty( $user_ids ) ) 1029 1014 return false; 1030 1015 1016 // Poster name 1017 $reply_author_name = bbp_get_reply_author_display_name( $reply_id ); 1018 1031 1019 /** Mail ******************************************************************/ 1032 1020 … … 1037 1025 1038 1026 // Don't send notifications to the person who made the post 1039 if ( (int) $user_id == (int) $reply->post_author )1027 if ( !empty( $reply_author ) && (int) $user_id == (int) $reply_author ) 1040 1028 continue; 1041 1029 1042 1030 // For plugins to filter messages per reply/topic/user 1043 1031 $message = __( "%1\$s wrote:\n\n%2\$s\n\nPost Link: %3\$s\n\nYou are recieving this email because you subscribed to it. Login and visit the topic to unsubscribe from these emails.", 'bbpress' ); 1044 $message = apply_filters( 'bbp_subscription_mail_message', sprintf( $message, $ poster_name, strip_tags( $reply->post_content), bbp_get_reply_url( $reply_id ) ), $reply_id, $topic_id, $user_id );1032 $message = apply_filters( 'bbp_subscription_mail_message', sprintf( $message, $reply_author_name, strip_tags( bbp_get_reply_content( $reply_id ) ), bbp_get_reply_url( $reply_id ) ), $reply_id, $topic_id, $user_id ); 1045 1033 if ( empty( $message ) ) 1046 1034 continue; 1047 1035 1048 1036 // For plugins to filter titles per reply/topic/user 1049 $subject = apply_filters( 'bbp_subscription_mail_title', '[' . get_option( 'blogname' ) . '] ' . $topic->post_title, $reply_id, $topic_id, $user_id );1037 $subject = apply_filters( 'bbp_subscription_mail_title', '[' . get_option( 'blogname' ) . '] ' . bbp_get_topic_title( $topic_id ), $reply_id, $topic_id, $user_id ); 1050 1038 if ( empty( $subject ) ) 1051 1039 continue;
Note: See TracChangeset
for help on using the changeset viewer.