--- loncom/interface/lonfeedback.pm	2006/12/11 04:10:35	1.235
+++ loncom/interface/lonfeedback.pm	2006/12/11 18:50:40	1.236
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.235 2006/12/11 04:10:35 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.236 2006/12/11 18:50:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2667,13 +2667,18 @@ sub secapply {
     my $defaultflag=shift;
     $rec=~s/\s+//g;
     $rec=~s/\@/\:/g;
-    my ($adr,$sections)=($rec=~/^([^\(]+)\(([^\)]+)\)/);
-    if ($sections) {
-	foreach my $sec (split(/\;/,$sections)) {
-            if (($sec eq $env{'request.course.sec'}) ||
-                ($defaultflag && ($sec eq '*'))) {
+    my ($adr,$sections_or_groups)=($rec=~/^([^\(]+)\(([^\)]+)\)/);
+    if ($sections_or_groups) {
+	foreach my $item (split(/\;/,$sections_or_groups)) {
+            if (($item eq $env{'request.course.sec'}) ||
+                ($defaultflag && ($item eq '*'))) {
                 return $adr; 
-            }
+            } elsif ($env{'request.course.groups'}) {
+                my @usersgroups = split(/:/,$env{'request.course.groups'});
+                if (grep(/^\Q$item\E$/,@usersgroups)) {
+                    return $adr;
+                }
+            } 
         }
     } else {
        return $rec;