--- /Users/daniele/Desktop/funzionando1.2/latest/moodle19/mod/data/edit.php	2010-09-17 02:04:17.000000000 +0200
+++ /Applications/MAMP/htdocs/moodle19/mod/data/edit.php	2010-09-23 12:12:30.000000000 +0200
@@ -1,4 +1,4 @@
-<?php  // $Id: edit.php,v 1.32.2.10 2010/09/16 10:42:18 andreabix Exp $
+<?php  // $Id: edit.php,v 1.32.2.8 2009/11/30 17:12:16 sam_marshall Exp $
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
 // NOTICE OF COPYRIGHT                                                   //
@@ -80,17 +80,25 @@
         }
     }

+/// Check to see if groups are being used here
+    groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/data/edit.php?d='.$data->id);
+    $currentgroup = groups_get_activity_group($cm);
+    $groupmode = groups_get_activity_groupmode($cm);
+
     if ($rid) {    // So do you have access?
         if (!(has_capability('mod/data:manageentries', $context) or data_isowner($rid)) or !confirm_sesskey() ) {
             print_error('noaccess','data');
         }
+    } else {
+        if (!data_user_can_add_entry($data, $currentgroup, $groupmode) || data_atmaxentries($data)) { // took out participation list here!
+            redirect('view.php?d='.$data->id, get_string('noaccess','data'));
+        }
     }

     if ($cancel) {
         redirect('view.php?d='.$data->id);
     }

-
 /// RSS and CSS and JS meta
     $meta = '';
     if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
@@ -114,11 +122,6 @@
                         '', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
                         navmenu($course, $cm), '', '');

-/// Check to see if groups are being used here
-    groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/data/edit.php?d='.$data->id);
-    $currentgroup = groups_get_activity_group($cm);
-    $groupmode = groups_get_activity_groupmode($cm);
-
     print_heading(format_string($data->name));

     if ($currentgroup) {
