Changeset 6264
- Timestamp:
- 01/27/2017 06:04:37 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r6227 r6264 1151 1151 $reply_author_name = bbp_get_reply_author_display_name( $reply_id ); 1152 1152 1153 /** Users *****************************************************************/ 1154 1155 // Get topic subscribers and bail if empty 1156 $user_ids = bbp_get_topic_subscribers( $topic_id, true ); 1157 1158 // Dedicated filter to manipulate user ID's to send emails to 1159 $user_ids = (array) apply_filters( 'bbp_topic_subscription_user_ids', $user_ids ); 1160 $user_ids = array_filter( array_map( 'intval', $user_ids ) ); 1161 if ( empty( $user_ids ) ) { 1162 return false; 1163 } 1164 1165 // Remove the reply author from the list. 1166 $reply_author_key = array_search( (int) $reply_author, $user_ids, true ); 1167 if ( false !== $reply_author_key ) { 1168 unset( $user_ids[ $reply_author_key ] ); 1169 } 1170 1171 // Bail of the reply author was the only one subscribed. 1172 if ( empty( $user_ids ) ) { 1173 return false; 1174 } 1175 1153 1176 /** Mail ******************************************************************/ 1154 1177 … … 1193 1216 } 1194 1217 1195 /** Users *****************************************************************/1218 /** Headers ***************************************************************/ 1196 1219 1197 1220 // Get the noreply@ address … … 1204 1227 $headers = array( 'From: ' . get_bloginfo( 'name' ) . ' <' . $from_email . '>' ); 1205 1228 1206 // Get topic subscribers and bail if empty1207 $user_ids = bbp_get_topic_subscribers( $topic_id, true );1208 1209 // Dedicated filter to manipulate user ID's to send emails to1210 $user_ids = apply_filters( 'bbp_topic_subscription_user_ids', $user_ids );1211 if ( empty( $user_ids ) ) {1212 return false;1213 }1214 1215 1229 // Loop through users 1216 1230 foreach ( (array) $user_ids as $user_id ) { 1217 1218 // Don't send notifications to the person who made the post1219 if ( ! empty( $reply_author ) && (int) $user_id === (int) $reply_author ) {1220 continue;1221 }1222 1223 // Get email address of subscribed user1224 1231 $headers[] = 'Bcc: ' . get_userdata( $user_id )->user_email; 1225 1232 } … … 1308 1315 $topic_author_name = bbp_get_topic_author_display_name( $topic_id ); 1309 1316 1317 /** Users *****************************************************************/ 1318 1319 // Get topic subscribers and bail if empty 1320 $user_ids = bbp_get_forum_subscribers( $forum_id, true ); 1321 1322 // Dedicated filter to manipulate user ID's to send emails to 1323 $user_ids = (array) apply_filters( 'bbp_forum_subscription_user_ids', $user_ids ); 1324 $user_ids = array_filter( array_map( 'intval', $user_ids ) ); 1325 if ( empty( $user_ids ) ) { 1326 return false; 1327 } 1328 1329 // Remove the topic author from the list. 1330 $topic_author_key = array_search( (int) $topic_author, $user_ids, true ); 1331 if ( false !== $topic_author_key ) { 1332 unset( $user_ids[ $topic_author_key ] ); 1333 } 1334 1335 // Bail of the topic author was the only one subscribed. 1336 if ( empty( $user_ids ) ) { 1337 return false; 1338 } 1339 1310 1340 /** Mail ******************************************************************/ 1311 1341 … … 1350 1380 } 1351 1381 1352 /** User ******************************************************************/1382 /** Headers ***************************************************************/ 1353 1383 1354 1384 // Get the noreply@ address … … 1361 1391 $headers = array( 'From: ' . get_bloginfo( 'name' ) . ' <' . $from_email . '>' ); 1362 1392 1363 // Get topic subscribers and bail if empty1364 $user_ids = bbp_get_forum_subscribers( $forum_id, true );1365 1366 // Dedicated filter to manipulate user ID's to send emails to1367 $user_ids = apply_filters( 'bbp_forum_subscription_user_ids', $user_ids );1368 if ( empty( $user_ids ) ) {1369 return false;1370 }1371 1372 1393 // Loop through users 1373 1394 foreach ( (array) $user_ids as $user_id ) { 1374 1375 // Don't send notifications to the person who made the post1376 if ( ! empty( $topic_author ) && (int) $user_id === (int) $topic_author ) {1377 continue;1378 }1379 1380 // Get email address of subscribed user1381 1395 $headers[] = 'Bcc: ' . get_userdata( $user_id )->user_email; 1382 1396 }
Note: See TracChangeset
for help on using the changeset viewer.