New Topic Email Notifications to Every Member in Mingle Forum WordPress Plugin

Tags:
mingle-forum-update

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")."<br/><br/>".
 
				__("Name:", "mingleforum")." ".$submitter_name."<br/>".
 
				//__("Email:", "mingleforum")." ".$submitter_email."<br/>".
 
				__("Date:", "mingleforum")." ".$this->format_date($date)."<br/>".
 
				__("Reply Content:", "mingleforum")."<br/>".$content."<br/><br/>".
 
				__("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.

Related posts:

  1. Send New Topic Email Notifications to Every User for Mingle Forum Plugin v 1.0.33
  2. Automatic Subscription for New Topic or Posting Comment to Get Email Notifications in Mingle Forum WordPress Plugin
  3. Setting up pop email account on Nokia N900 when outgoing email server requires authentication
  4. Adding “unsubscribe” Link in Interspire Email Marketer
  5. Lead Generation in WordPress – Get A Quote Form, Contact Forms Plugin for WordPress