diff --git a/mod/data/backup/moodle2/backup_data_stepslib.php b/mod/data/backup/moodle2/backup_data_stepslib.php
index 691b059..f7fed32 100644
--- a/mod/data/backup/moodle2/backup_data_stepslib.php
+++ b/mod/data/backup/moodle2/backup_data_stepslib.php
@@ -45,7 +45,7 @@ class backup_data_activity_structure_step extends backup_activity_structure_step
             'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate',
             'jstemplate', 'asearchtemplate', 'approval', 'scale',
             'assessed', 'assesstimestart', 'assesstimefinish', 'defaultsort',
-            'defaultsortdir', 'editany', 'notification'));
+            'defaultsortdir', 'editany', 'notification', 'rsscomments'));
 
         $fields = new backup_nested_element('fields');
 
diff --git a/mod/data/db/install.xml b/mod/data/db/install.xml
index 58f086e..9f38c0c 100644
--- a/mod/data/db/install.xml
+++ b/mod/data/db/install.xml
@@ -38,7 +38,8 @@
         <FIELD NAME="defaultsort" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="assesstimefinish" NEXT="defaultsortdir"/>
         <FIELD NAME="defaultsortdir" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="defaultsort" NEXT="editany"/>
         <FIELD NAME="editany" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="defaultsortdir" NEXT="notification"/>
-        <FIELD NAME="notification" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify people when things change" PREVIOUS="editany"/>
+        <FIELD NAME="notification" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify people when things change" PREVIOUS="editany" NEXT="rsscomments"/>
+	<FIELD NAME="rsscomments" TYPE="int" LENGTH="4" NOTNULL="true" USIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="notification"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
@@ -106,4 +107,4 @@
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
diff --git a/mod/data/db/upgrade.php b/mod/data/db/upgrade.php
index 1d85846..c3034e4 100644
--- a/mod/data/db/upgrade.php
+++ b/mod/data/db/upgrade.php
@@ -313,6 +313,17 @@ function xmldb_data_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2010100101, 'data');
     }
 
+    if ($oldversion < 2010120400) {
+        $table = new xmldb_table('data');
+        $field = new xmldb_field('rsscomments', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'notification');
+        
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        upgrade_mod_savepoint(true, 2010120400, 'data');
+    }
+
     return true;
 }
 
diff --git a/mod/data/edit.php b/mod/data/edit.php
index 34aef3f..bad2b69 100755
--- a/mod/data/edit.php
+++ b/mod/data/edit.php
@@ -103,12 +103,13 @@ if ($cancel) {
     redirect('view.php?d='.$data->id);
 }
 
-
 /// RSS and CSS and JS meta
-if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
-    $rsspath = rss_get_url($context->id, $USER->id, 'mod_data', $data->id);
-    $PAGE->add_alternate_version(format_string($course->shortname) . ': %fullname%',
-            $rsspath, 'application/rss+xml');
+if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds)) {
+    if ($data->rssarticles > 0) {
+        $rsspath = rss_get_url($context->id, $USER->id, 'mod_data', $data->id);
+                $PAGE->add_alternate_version(format_string($course->shortname) . ': %fullname%',
+                                    $rsspath, 'application/rss+xml');
+    }
 }
 if ($data->csstemplate) {
     $PAGE->requires->css('/mod/data/css.php?d='.$data->id);
diff --git a/mod/data/lang/en/data.php b/mod/data/lang/en/data.php
index 4188193..6803eec 100755
--- a/mod/data/lang/en/data.php
+++ b/mod/data/lang/en/data.php
@@ -57,11 +57,13 @@ $string['cannotdeletepreset'] = 'Error deleting a preset!';
 $string['cannotunziptopreset'] = 'Cannot unzip to the preset directory';
 $string['columns'] = 'columns';
 $string['comment'] = 'Comment';
+$string['commentby'] = 'Comment by';
 $string['commentdeleted'] = 'Comment deleted';
 $string['commentempty'] = 'Comment was empty';
 $string['comments'] = 'Comments';
 $string['commentsaved'] = 'Comment saved';
 $string['commentsn'] = '{$a} comment(s)';
+$string['commentsrss'] = '(comments)';
 $string['configenablerssfeeds'] = 'This switch will enable the possibility of RSS feeds for all databases. You will still need to turn feeds on manually in the settings for each database.';
 $string['confirmdeletefield'] = 'You are about to delete this field, are you sure?';
 $string['confirmdeleterecord'] = 'Are you sure you want to delete this entry?';
@@ -241,6 +243,7 @@ $string['notinjectivemap'] = 'Not an injective map';
 $string['notopenyet'] = 'Sorry, this activity is not available until {$a}';
 $string['number'] = 'Number';
 $string['numberrssarticles'] = 'RSS articles';
+$string['numberrsscomments'] = 'RSS comments';
 $string['numnotapproved'] = 'Pending';
 $string['numrecords'] = '{$a} entries';
 $string['ods'] = '<acronym title="OpenDocument Spreadsheet">ODS</acronym> (OpenOffice)';
@@ -276,6 +279,7 @@ $string['resetsettings'] = 'Reset filters';
 $string['resettemplate'] = 'Reset template';
 $string['resizingimages'] = 'Resizing image thumbnails...';
 $string['rows'] = 'rows';
+$string['rsscomments'] = 'RSS feed for comments on this entry';
 $string['rssglobaldisabled'] = 'Disabled. See site configuration variables.';
 $string['rsshowmany'] = '(number of latest entries to show, 0 to disable RSS)';
 $string['rsstemplate'] = 'RSS template';
diff --git a/mod/data/lib.php b/mod/data/lib.php
index a22aa6b..e64292e 100755
--- a/mod/data/lib.php
+++ b/mod/data/lib.php
@@ -1194,7 +1194,7 @@ function data_get_participants($dataid) {
  * @return mixed
  */
 function data_print_template($template, $records, $data, $search='', $page=0, $return=false) {
-    global $CFG, $DB, $OUTPUT;
+    global $CFG, $DB, $OUTPUT, $USER;
     $cm = get_coursemodule_from_instance('data', $data->id);
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
@@ -1302,6 +1302,7 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r
                 $cmt->showcount = true;
                 $cmt->component = 'mod_data';
                 $comment = new comment($cmt);
+
                 $replacement[] = $comment->output(true);
             }
         } else {
@@ -1341,7 +1342,16 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r
                     $cmt->showcount = true;
                     $cmt->component = 'mod_data';
                     $comment = new comment($cmt);
+
+                    $rsslink = '';
+                    if ($data->rsscomments > 0) {
+                        require_once("$CFG->libdir/rsslib.php");
+                        $url = new moodle_url(rss_get_url($context->id, $USER->id, 'mod_data', $data->id.'/comments/'.$record->id));
+                        $rsslink = '<br /><a href="'.$url.'" ><img src="'.$OUTPUT->pix_url('i/rss').'" /> '.get_string('rsscomments','data').'</a>';
+                    }
+                
                     $comment->output(false);
+                    echo $rsslink;
                 }
             }
         }
@@ -2876,14 +2886,34 @@ function data_extend_settings_navigation(settings_navigation $settings, navigati
         $datanode->add(get_string('presets', 'data'), new moodle_url('/mod/data/preset.php', array('d'=>$data->id)));
     }
 
-    if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
-        require_once("$CFG->libdir/rsslib.php");
+    if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds)) {
+        if ($data->rssarticles > 0) {
+            require_once("$CFG->libdir/rsslib.php");
 
-        $string = get_string('rsstype','forum');
+            $string = get_string('rsstype','forum');
 
-        $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $USER->id, 'mod_data', $data->id));
-        $datanode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
+            $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $USER->id, 'mod_data', $data->id));
+            $datanode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
+        }
+
+        if ($data->rsscomments > 0) {
+            if (!$rid = optional_param('rid', false, PARAM_INT)) {
+                if (optional_param('mode', false, PARAM_TEXT) == 'single') {
+                    // There does not appear to be a sensible to get the current record id at this point
+                }
+            }
+
+            if ($rid) {
+                require_once("$CFG->libdir/rsslib.php");
+
+                $string = get_string('rsscomments', 'data');
+            
+                $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $USER->id, 'mod_data', $data->id.'/comments/'.$rid));
+                $datanode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
+            }
+        }
     }
+
 }
 
 /**
diff --git a/mod/data/mod_form.php b/mod/data/mod_form.php
index c5f7120..71cc74d 100644
--- a/mod/data/mod_form.php
+++ b/mod/data/mod_form.php
@@ -54,6 +54,7 @@ class mod_data_mod_form extends moodleform_mod {
 
         if($CFG->enablerssfeeds && $CFG->data_enablerssfeeds){
             $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions);
+            $mform->addElement('select', 'rsscomments', get_string('numberrsscomments', 'data') , $countoptions);
         }
 
         $this->standard_grading_coursemodule_elements();
diff --git a/mod/data/rsslib.php b/mod/data/rsslib.php
index 00bad5c..ea12772 100644
--- a/mod/data/rsslib.php
+++ b/mod/data/rsslib.php
@@ -23,76 +23,148 @@
             return null;
         }
 
-        $sql = data_rss_get_sql($data);
-
-        //get the cache file info
-        $filename = rss_get_file_name($data, $sql);
-        $cachedfilepath = rss_get_file_full_name('mod_data', $filename);
+        if (clean_param($args[4], PARAM_TEXT) == 'comments') {
+            if ($data->rsscomments == 0) {
+                return null;
+            }
 
-        //Is the cache out of date?
-        $cachedfilelastmodified = 0;
-        if (file_exists($cachedfilepath)) {
-            $cachedfilelastmodified = filemtime($cachedfilepath);
-        }
-        //if the cache is more than 60 seconds old and there's new stuff
-        $dontrecheckcutoff = time()-60;
-        if ( $dontrecheckcutoff > $cachedfilelastmodified && data_rss_newstuff($data, $cachedfilelastmodified)) {
-            require_once($CFG->dirroot . '/mod/data/lib.php');
+            $rid = clean_param($args[5], PARAM_INT);
 
-            // Get the first field in the list  (a hack for now until we have a selector)
-            if (!$firstfield = $DB->get_record_sql('SELECT id,name FROM {data_fields} WHERE dataid = ? ORDER by id', array($data->id), true)) {
+            $record = $DB->get_record('data_records', array('id'=>$rid));
+            if (!$record || ($record->dataid != $data->id)) {
                 return null;
             }
 
-            if (!$records = $DB->get_records_sql($sql, array(), 0, $data->rssarticles)) {
-                return null;
+            $sql = data_rss_get_comments_sql($context->id, $record->id);
+
+            //get the cache file info
+            $filename = rss_get_file_name($data, $sql);
+            $cachedfilepath = rss_get_file_full_name('mod_data', $filename);
+
+            //Is the cache out of date?
+            $cachedfilelastmodified = 0;
+            if (file_exists($cachedfilepath)) {
+                $cachedfilelastmodified = filemtime($cachedfilepath);
             }
-            
-            $firstrecord = array_shift($records);  // Get the first and put it back
-            array_unshift($records, $firstrecord);
-
-            // Now create all the articles
-            $items = array();
-            foreach ($records as $record) {
-                $recordarray = array();
-                array_push($recordarray, $record);
-
-                $item = null;
-
-                // guess title or not
-                if (!empty($data->rsstitletemplate)) {
-                    $item->title = data_print_template('rsstitletemplate', $recordarray, $data, '', 0, true);
-                } else { // else we guess
-                    $item->title   = strip_tags($DB->get_field('data_content', 'content',
-                                                      array('fieldid'=>$firstfield->id, 'recordid'=>$record->id)));
+            //if the cache is more than 60 seconds old and there's new stuff
+            $dontrecheckcutoff = time()-60;
+            if ( $dontrecheckcutoff > $cachedfilelastmodified && data_rss_comments_newstuff($context->id, $record->id, $cachedfilelastmodified)) {
+                require_once($CFG->dirroot . '/mod/data/lib.php');
+                
+                if (!$comments = $DB->get_records_sql($sql, array(), 0, $data->rsscomments)) {
+                    return null;
                 }
-                $item->description = data_print_template('rsstemplate', $recordarray, $data, '', 0, true);
-                $item->pubdate = $record->timecreated;
-                $item->link = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id;
 
-                array_push($items, $item);
-            }
-            $course = $DB->get_record('course', array('id'=>$data->course));
+                $items = array();
+
+                foreach ($comments as $comment) {
+                    $item = null;
+
+                    $item->title = get_string('commentby','data').' '.$comment->firstname.' '.$comment->lastname;
+                    $item->description = format_text($comment->content, $comment->format);
+                    $item->pubdate = $comment->timecreated;
+                    $item->link = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id;
+
+                    array_push($items, $item);
+                }
+
+                $course = $DB->get_record('course', array('id'=>$data->course));
 
-            // First all rss feeds common headers.
-            $header = rss_standard_header($course->shortname.': '.format_string($data->name,true),
-                                          $CFG->wwwroot."/mod/data/view.php?d=".$data->id,
-                                          format_string($data->intro,true)); //TODO: fix format
+                // First all rss feeds common headers.
+                $header = rss_standard_header($course->shortname.': '.format_string($data->name,true).' '.get_string('commentsrss','data'),
+                                              $CFG->wwwroot."/mod/data/view.php?d=".$data->id.'&rid='.$record->id,
+                                              format_string($data->intro,true)); //TODO: fix format
 
-            if (!empty($header)) {
-                $articles = rss_add_items($items);
+                if (!empty($header)) {
+                    $articles = rss_add_items($items);
+                }
+
+                // Now all rss feeds common footers.
+                if (!empty($header) && !empty($articles)) {
+                    $footer = rss_standard_footer();
+                }
+                // Now, if everything is ok, concatenate it.
+                if (!empty($header) && !empty($articles) && !empty($footer)) {
+                    $rss = $header.$articles.$footer;
+
+                    //Save the XML contents to file.
+                    $status = rss_save_file('mod_data', $filename, $rss);
+                }
             }
 
-            // Now all rss feeds common footers.
-            if (!empty($header) && !empty($articles)) {
-                $footer = rss_standard_footer();
+        } else {
+            
+            $sql = data_rss_get_sql($data);
+
+            //get the cache file info
+            $filename = rss_get_file_name($data, $sql);
+            $cachedfilepath = rss_get_file_full_name('mod_data', $filename);
+
+            //Is the cache out of date?
+            $cachedfilelastmodified = 0;
+            if (file_exists($cachedfilepath)) {
+                $cachedfilelastmodified = filemtime($cachedfilepath);
             }
-            // Now, if everything is ok, concatenate it.
-            if (!empty($header) && !empty($articles) && !empty($footer)) {
-                $rss = $header.$articles.$footer;
+            //if the cache is more than 60 seconds old and there's new stuff
+            $dontrecheckcutoff = time()-60;
+            if ( $dontrecheckcutoff > $cachedfilelastmodified && data_rss_newstuff($data, $cachedfilelastmodified)) {
+                require_once($CFG->dirroot . '/mod/data/lib.php');
+
+                // Get the first field in the list  (a hack for now until we have a selector)
+                if (!$firstfield = $DB->get_record_sql('SELECT id,name FROM {data_fields} WHERE dataid = ? ORDER by id', array($data->id), true)) {
+                    return null;
+                }
+
+                if (!$records = $DB->get_records_sql($sql, array(), 0, $data->rssarticles)) {
+                    return null;
+                }
+            
+                $firstrecord = array_shift($records);  // Get the first and put it back
+                array_unshift($records, $firstrecord);
+
+                // Now create all the articles
+                $items = array();
+                foreach ($records as $record) {
+                    $recordarray = array();
+                    array_push($recordarray, $record);
+
+                    $item = null;
+
+                    // guess title or not
+                    if (!empty($data->rsstitletemplate)) {
+                        $item->title = data_print_template('rsstitletemplate', $recordarray, $data, '', 0, true);
+                    } else { // else we guess
+                        $item->title   = strip_tags($DB->get_field('data_content', 'content',
+                                                                   array('fieldid'=>$firstfield->id, 'recordid'=>$record->id)));
+                    }
+                    $item->description = data_print_template('rsstemplate', $recordarray, $data, '', 0, true);
+                    $item->pubdate = $record->timecreated;
+                    $item->link = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id;
+
+                    array_push($items, $item);
+                }
+                $course = $DB->get_record('course', array('id'=>$data->course));
 
-                //Save the XML contents to file.
-                $status = rss_save_file('mod_data', $filename, $rss);
+                // First all rss feeds common headers.
+                $header = rss_standard_header($course->shortname.': '.format_string($data->name,true),
+                                              $CFG->wwwroot."/mod/data/view.php?d=".$data->id,
+                                              format_string($data->intro,true)); //TODO: fix format
+
+                if (!empty($header)) {
+                    $articles = rss_add_items($items);
+                }
+
+                // Now all rss feeds common footers.
+                if (!empty($header) && !empty($articles)) {
+                    $footer = rss_standard_footer();
+                }
+                // Now, if everything is ok, concatenate it.
+                if (!empty($header) && !empty($articles) && !empty($footer)) {
+                    $rss = $header.$articles.$footer;
+
+                    //Save the XML contents to file.
+                    $status = rss_save_file('mod_data', $filename, $rss);
+                }
             }
         }
 
@@ -118,6 +190,24 @@
         return $sql;
     }
 
+    function data_rss_get_comments_sql($contextid, $recordid, $time=0) {
+        //do we only want new comments?
+        if ($time) {
+            $time = " AND c.timecreated > '$time'";
+        } else {
+            $time = '';
+        }
+
+        $sql = "SELECT c.*, u.firstname, u.lastname
+                  FROM {comments} c, {user} u
+                 WHERE c.contextid = {$contextid} 
+                       AND c.itemid = {$recordid}
+                       AND c.userid = u.id $time
+              ORDER BY c.timecreated DESC";
+
+        return $sql;
+    }
+
     /**
      * If there is new stuff in since $time this returns true
      * Otherwise it returns false.
@@ -135,3 +225,22 @@
         return ($recs && !empty($recs));
     }
 
+    /**
+     * If there is new stuff in since $time this returns true
+     * Otherwise it returns false.
+     *
+     * @param object $data the data activity object
+     * @param int $time timestamp
+     * @return bool
+     */
+     function data_rss_comments_newstuff($contextid, $recordid, $time) {
+         return true; // FIXME remove this line
+
+         global $DB;
+         
+         $sql = data_rss_get_comments_sql($contextid, $recordid, $time);
+
+         $recs = $DB->get_records_sql($sql, null, 0, 1);//limit of 1. If we get even 1 back we have new stuff
+         return ($recs && !empty($recs));
+    }
+
diff --git a/mod/data/version.php b/mod/data/version.php
index b57666a..b680f6c 100644
--- a/mod/data/version.php
+++ b/mod/data/version.php
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2010100101;
+$module->version  = 2010120400;
 $module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 60;
 
