Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.526 diff -u -p -r1.526 comment.module --- modules/comment/comment.module 1 Mar 2007 19:53:04 -0000 1.526 +++ modules/comment/comment.module 6 Mar 2007 01:28:38 -0000 @@ -246,12 +246,17 @@ function comment_block($op = 'list', $de * 2. Loading the information from the comments table based on the nids found * in step 1. * - * @param $number (optional) The maximum number of comments to find. + * @param $number (optional) The maximum number of comments to find. If not set, + * the number configured by the administrator will be used. * @return $comments An array of comment objects each containing a nid, * subject, cid, and timstamp, or an empty array if there are no recent * comments visible to the current user. */ -function comment_get_recent($number = 10) { +function comment_get_recent($number = NULL) { + if ($number === NULL) { + $number = variable_get('comment_block_display_amount', 10); + } + // Select the $number nodes (visible to the current user) with the most // recent comments. This is efficient due to the index on // last_comment_timestamp. @@ -504,6 +509,14 @@ function comment_admin_settings() { '#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'), ); + $form['viewing_options']['comment_block_display_amount'] = array( + '#type' => 'select', + '#title' => t('Amount of comments in block'), + '#default_value' => variable_get('comment_block_display_amount', 10), + '#options' => _comment_display_amount(), + '#description' => t('Amount of comments to display in block with recent comments.'), + ); + $form['viewing_options']['comment_default_per_page'] = array( '#type' => 'select', '#title' => t('Default comments per page'), @@ -1888,6 +1901,14 @@ function _comment_get_orders() { } /** + * Return an array of "amount of comments" for recent comment + * block from which the user can choose. + */ +function _comment_display_amount() { + return drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)); +} + +/** * Return an array of "comments per page" settings from which the user * can choose. */