Mingle Forum is very useful WordPress Plugin that allows you to quickly put a Forum on your WordPress site/blog.
Email notifications in Mingle Forums is one area which needs improvement. My client wanted a feature where every member would get email notifications for any new topic started by any user. Since it’s not available in the existing features of Mingle Forum Plugin, I added it myself and you can also very easily integrate this in your forums by adding following code in your plugin class file.
Step 1
Open: plugins/mingle-forum/wpf.class.php
Find code: function notify_starter
Add following function below after the function closed curly bracket:
function notify_all_users($thread, $subject, $content, $date){
global $wpdb, $user_ID;
$users = $wpdb->get_results("SELECT user_email FROM {$wpdb->users} ORDER BY user_login ASC");
$submitter = get_userdata($user_ID);
$submitter_name = $this->get_userdata($user_ID, $this->options['forum_display_name']);
$submitter_email = $submitter->user_email;
$sender = get_bloginfo("name");
$subject = __("New Topic:", "mingleforum")." '$subject'.";
$message = __("DETAILS:", "mingleforum")."
".
__("Name:", "mingleforum")." ".$submitter_name."
".
//__("Email:", "mingleforum")." ".$submitter_email."
".
__("Date:", "mingleforum")." ".$this->format_date($date)."
".
__("Reply Content:", "mingleforum")."
".$content."
".
__("View Topic Here:", "mingleforum")." ".$this->get_threadlink($thread);
$replyto = get_bloginfo("admin_email");
$headers = "MIME-Version: 1.0\r\n" .
"From: ".$sender." "."<".$replyto.">\n" .
"Content-Type: text/HTML; charset=\"" . get_option('blog_charset') . "\"\r\n";
foreach($users as $u){
$to = $u->user_email;
if(!empty($to))
wp_mail($to, $subject, make_clickable(convert_smilies(wpautop($this->output_filter(stripslashes($message))))), $headers);
}
}
Step 2
Open: plugins/mingle-forum/wpf-insert.php
Find following code:
$mingleforum->notify_starter($id, $subject, $content, $date);
Comment the above line and add this below:
//$mingleforum->notify_starter($id, $subject, $content, $date);
$mingleforum->notify_all_users($id, $subject, $content, $date);
Please note that this will start sending email notifications of every new topic to all your forums members. You might want to increase the max_execution_time in your php.ini to 0 (unlimited) or at least much higher than the default 30 seconds, otherwise your script might timed out before completing the sending request.
Hi Ali,
Thanks for doing this plugin. Where can I download it? Thanks!
I have posted updated code in a new blog post. It will allow you to send New Topic Email notifications to every user of your blog.
Thanks for your Plug in ideas. I am waning to send all new registered users an email with instructions on how to post in the forum change their settings and such and do not have time to respond to every new user. Sending an automated email with instructions would make things so much easier. Can this be augmented for that?
Hi Amber,
I have made some modifications in the current Mingle Forum Plugin (version 1.0.33) and it send notifications to every user for each newly created Category Group, Forum, Topic or any reply to any topic.
I can create a user for you in the demo WordPress website here http://wordpress.parorrey.com/ so that you could test it yourself. Let me know if you want this.
I could not find any of the codes you described for plugins/mingle-forum/wpf-insert.php
or in plugins/mingle-forum/wpf-insert.php
I need desparately to have every member be notified of every new topic and added comment to all categories in Mingle-Forum and would love to know how to make that happen. Any help would be greatly appreciated, Ken
The above hack were for the Mingle Forum plugin for the version 1.0.31 or before. The newer version must have changed few things around but the hack should still work and can be adopted.
I check the notes of latest version and found this: “Mingle forum 1.0.32 uses a new email subscription system. All old subscriptions will be lost after upgrading. This will allow much better email support for the future.”
I have had no luck getting it to work, What would you charge me to plug that into my site HospitalCTA.com? Thanks,
Ken Piorun
The above code was for earlier version of Mingle Forum. I’ve sent you instructions for the current 1.0.33 version where all the email notifications have been changed.