@@ -784,7 +784,7 @@ public static function send_notifications_reply($tid, $cur_posting, $new_pid, $p
784784 array ('fp.read_forum ' => 'IS NULL ' ),
785785 array ('fp.read_forum ' => '1 ' )
786786 );
787- $ result ['select ' ] = array ('u.id ' , 'u.email ' , 'u.notify_with_post ' );
787+ $ result ['select ' ] = array ('u.id ' , 'u.email ' , 'u.group_id ' );
788788
789789 $ result = DB ::for_table ('users ' )
790790 ->table_alias ('u ' )
@@ -815,15 +815,16 @@ public static function send_notifications_reply($tid, $cur_posting, $new_pid, $p
815815
816816 // Loop through subscribed users and send emails
817817 foreach ($ result as $ cur_subscriber ) {
818+ $ cur_subscriber ['prefs ' ] = Container::get ('prefs ' )->loadPrefs ($ cur_subscriber );
818819 // Is the subscription email for User::getPref('language', $cur_subscriber['id']) cached or not?
819- if (!isset ($ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ])) {
820- if (file_exists (ForumEnv::get ('FEATHER_ROOT ' ).'featherbb/lang/ ' .User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) .'/mail_templates/new_reply.tpl ' )) {
820+ if (!isset ($ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ])) {
821+ if (file_exists (ForumEnv::get ('FEATHER_ROOT ' ).'featherbb/lang/ ' .$ cur_subscriber ['prefs ' ][ ' language ' ] .'/mail_templates/new_reply.tpl ' )) {
821822 // Load the "new reply" template
822- $ mail_tpl = trim (file_get_contents (ForumEnv::get ('FEATHER_ROOT ' ).'featherbb/lang/ ' .User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) .'/mail_templates/new_reply.tpl ' ));
823+ $ mail_tpl = trim (file_get_contents (ForumEnv::get ('FEATHER_ROOT ' ).'featherbb/lang/ ' .$ cur_subscriber ['prefs ' ][ ' language ' ] .'/mail_templates/new_reply.tpl ' ));
823824 $ mail_tpl = Container::get ('hooks ' )->fire ('model.post.send_notifications_reply_mail_tpl ' , $ mail_tpl );
824825
825826 // Load the "new reply full" template (with post included)
826- $ mail_tpl_full = trim (file_get_contents (ForumEnv::get ('FEATHER_ROOT ' ).'featherbb/lang/ ' .User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) .'/mail_templates/new_reply_full.tpl ' ));
827+ $ mail_tpl_full = trim (file_get_contents (ForumEnv::get ('FEATHER_ROOT ' ).'featherbb/lang/ ' .$ cur_subscriber ['prefs ' ][ ' language ' ] .'/mail_templates/new_reply_full.tpl ' ));
827828 $ mail_tpl_full = Container::get ('hooks ' )->fire ('model.post.send_notifications_reply_mail_tpl_full ' , $ mail_tpl_full );
828829
829830 // The first row contains the subject (it also starts with "Subject:")
@@ -853,21 +854,21 @@ public static function send_notifications_reply($tid, $cur_posting, $new_pid, $p
853854 $ mail_message_full = str_replace ('<board_mailer> ' , ForumSettings::get ('o_board_title ' ), $ mail_message_full );
854855 $ mail_message_full = Container::get ('hooks ' )->fire ('model.post.send_notifications_reply_mail_message_full ' , $ mail_message_full );
855856
856- $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ][0 ] = $ mail_subject ;
857- $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ][1 ] = $ mail_message ;
858- $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ][2 ] = $ mail_subject_full ;
859- $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ][3 ] = $ mail_message_full ;
857+ $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ][0 ] = $ mail_subject ;
858+ $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ][1 ] = $ mail_message ;
859+ $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ][2 ] = $ mail_subject_full ;
860+ $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ][3 ] = $ mail_message_full ;
860861
861862 $ mail_subject = $ mail_message = $ mail_subject_full = $ mail_message_full = null ;
862863 }
863864 }
864865
865866 // We have to double check here because the templates could be missing
866- if (isset ($ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ])) {
867- if ($ cur_subscriber ['notify_with_post ' ] == '0 ' ) {
868- Container::get ('email ' )->feather_mail ($ cur_subscriber ['email ' ], $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ])] [0 ], $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ][1 ]);
867+ if (isset ($ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ])) {
868+ if ($ cur_subscriber ['prefs ' ][ ' notify_with_post ' ] == '0 ' ) {
869+ Container::get ('email ' )->feather_mail ($ cur_subscriber ['email ' ], $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ]] [0 ], $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ][1 ]);
869870 } else {
870- Container::get ('email ' )->feather_mail ($ cur_subscriber ['email ' ], $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ])] [2 ], $ notification_emails [User:: getPref ( ' language ' , $ cur_subscriber ['id ' ]) ][3 ]);
871+ Container::get ('email ' )->feather_mail ($ cur_subscriber ['email ' ], $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ]] [2 ], $ notification_emails [$ cur_subscriber ['prefs ' ][ ' language ' ] ][3 ]);
871872 }
872873 }
873874 }
@@ -995,7 +996,7 @@ public function send_notifications_new_topic($post, $cur_posting, $new_tid)
995996 array ('fp.read_forum ' => 'IS NULL ' ),
996997 array ('fp.read_forum ' => '1 ' )
997998 );
998- $ result ['select ' ] = array ('u.id ' , 'u.group_id ' , 'u.email ' , ' u.notify_with_post ' );
999+ $ result ['select ' ] = array ('u.id ' , 'u.group_id ' , 'u.email ' );
9991000
10001001 $ result = DB ::for_table ('users ' )
10011002 ->table_alias ('u ' )
@@ -1075,7 +1076,7 @@ public function send_notifications_new_topic($post, $cur_posting, $new_tid)
10751076
10761077 // We have to double check here because the templates could be missing
10771078 if (isset ($ notification_emails [$ cur_subscriber ['prefs ' ]['language ' ]])) {
1078- if ($ cur_subscriber ['notify_with_post ' ] == '0 ' ) {
1079+ if ($ cur_subscriber ['prefs ' ][ ' notify_with_post ' ] == '0 ' ) {
10791080 Container::get ('email ' )->feather_mail ($ cur_subscriber ['email ' ], $ notification_emails [$ cur_subscriber ['prefs ' ]['language ' ]][0 ], $ notification_emails [$ cur_subscriber ['prefs ' ]['language ' ]][1 ]);
10801081 } else {
10811082 Container::get ('email ' )->feather_mail ($ cur_subscriber ['email ' ], $ notification_emails [$ cur_subscriber ['prefs ' ]['language ' ]][2 ], $ notification_emails [$ cur_subscriber ['prefs ' ]['language ' ]][3 ]);
0 commit comments