Automatic Subscription for New Topic or Posting Comment to Get Email Notifications in Mingle Forum WordPress Plugin

Tags:

Mingle Forum is very useful WordPress Plugin that allows you to quickly put a Forum on your WordPress site/blog.

While it has many useful features, one of my client asked me to add a feature where any user would get email notifications for any comments made on his created topic or where he posted his comments a la Facebook comments.

Although Mingle Forum plugin allowed to subscribe to threads, but it was not done automatically as it’s done on Facebook. I have crated a mod for this and you can check the details below if you want to add this feature too in your Mingle Forum Plugin.

Step 1

Open: plugins/mingle-forum/wpf.class.php

Find code: function notify_post(){

Add following above:

 
function subscribe_post($id){
		global $wpdb, $user_ID;		
 
		$op = get_user_meta($user_ID, "wpf_useroptions", true);
 
		$topics = $op['notify_topics'];
 
		if (!is_array($topics))
 
			$topics = array();
 
		// Add topic
 
		if(!$this->array_search($id, $topics, TRUE)){
 
			$topics[] = $id;
 
		}	
 
		// Build array
 
		$op = array(	"allow_profile" => $op['allow_profile'],
 
						"notify_topics" => (array)$topics,
 
						"signature" => $op['signature']);
 
		// Update meta
 
		update_user_meta($user_ID, "wpf_useroptions", $op);
 
	}

Step 2

Open: plugins/mingle-forum/wpf-insert.php

Find following code:

 
$wpdb->query($wpdb->prepare($sql_thread));
 
$id = $wpdb->insert_id;

Add this below:

 
 //start automatic subscription
 $mingleforum->subscribe_post($id);
 //end automatic subscription

In the same file plugins/mingle-forum/wpf-insert.php

Find following code:

 
if(!$error){
  $mingleforum->notify_starter($thread, $subject, $content, $date);

Add this below:

 
 //start automatic subscription
  $mingleforum->subscribe_post($thread);
 //end automatic subscription

hope that helps.

Cheers.

Related posts:

  1. New Topic Email Notifications to Every Member in Mingle Forum WordPress Plugin
  2. Send New Topic Email Notifications to Every User for Mingle Forum Plugin v 1.0.33
  3. WordPress Custom Post Type Listing by Alphabets with Alphabetical Navigation
  4. Fix W3 Total Cache WordPress Plugin Error ‘Warning: Cannot modify header information – headers already sent’
  5. WordPress Custom Post Types – Best Plugin for the Job and How to Set it Up