? .project
? .settings
? admin_perm.patch
? aggregator_sql_clean_up.patch
? autocomplete.js_4.patch
? blah.patch
? blocks_fapi3_fix.patch
? browser.patch.txt
? comment-block.patch
? comment-specify-number-of-recent-comments-81931-13.patch
? comment-specify-number-of-recent-comments-81931-15.patch
? comment_filter_3.patch
? dapi_content_types_0.patch
? dapi_path_fix_0.patch
? dapi_path_fix_1.patch
? dapi_path_fix_2.patch
? dynamic_form_ids_patch.txt
? files
? make_taxonomy_widget_themable_4-7-2above.patch
? modulecommentsblockamount.patch
? node_title_255_2.patch
? profile.patch_2.txt
? profile_27.patch
? profile_module_reworked_categories.patch
? taxonomy.patch_4.txt
? taxonomy_get_path.patch
? taxonomy_node_get_terms_1.patch
? theme-form-checkboxes-error-bug44933-alt2.patch
? update-script-access-rights_3.patch
? user-link-new-name-130108-4.patch
? user-link_0.patch
? utility_functions.patch
? welcome_patch
? sites/default/settings.php
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.555
diff -u -p -r1.555 comment.module
--- modules/comment/comment.module	24 Jun 2007 00:38:40 -0000	1.555
+++ modules/comment/comment.module	24 Jun 2007 08:19:16 -0000
@@ -276,15 +276,32 @@ function comment_perm() {
  *
  * Generates a block with the most recent comments.
  */
-function comment_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('Recent comments');
-    return $blocks;
-  }
-  else if ($op == 'view' && user_access('access comments')) {
-    $block['subject'] = t('Recent comments');
-    $block['content'] = theme('comment_block');
-    return $block;
+function comment_block($op = 'list', $delta = 0, $edit = array()) {
+  switch ($op) {
+    case 'list':
+      $blocks[0]['info'] = t('Recent comments');
+      return $blocks;
+
+    case 'configure':
+      $form['comment_recent_count'] = array(
+        '#type' => 'select',
+        '#title' => t('Number of recent comments'),
+        '#default_value' => variable_get('comment_recent_count', 10),
+        '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)),
+        '#description' => t('Number of comments to display in block with recent comments.'),
+      );
+      return $form;
+
+    case 'save':
+      variable_set('comment_recent_count', (int)$edit['comment_recent_count']);
+      break;
+
+    case 'view':
+      if (user_access('access comments')) {
+        $block['subject'] = t('Recent comments');
+        $block['content'] = theme('comment_block');
+        return $block;
+      }
   }
 }
 
@@ -333,7 +350,8 @@ function comment_get_recent($number = 10
  */
 function theme_comment_block() {
   $items = array();
-  foreach (comment_get_recent() as $comment) {
+  $number = variable_get('comment_recent_count', 10);
+  foreach (comment_get_recent($number) as $comment) {
     $items[] = l($comment->subject, 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid)) .'<br />'. t('@time ago', array('@time' => format_interval(time() - $comment->timestamp)));
   }
   if ($items) {
