summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-09-11 08:26:47 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-09-11 08:26:47 +0000
commite21c0c6545f49a62b6ee1e1527674ad2d15b8e90 (patch)
tree0b164ff4fb24d635be7b6f209d14c6529212fbb0
parent48bbf7207cf348aafe067cf3a4848a9f342da3a0 (diff)
downloadbrdo-e21c0c6545f49a62b6ee1e1527674ad2d15b8e90.tar.gz
brdo-e21c0c6545f49a62b6ee1e1527674ad2d15b8e90.tar.bz2
#40535 by Wesley Tanaka. Configurable number of user for the "Who's new" block.
-rw-r--r--modules/user/user.module14
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 3ce083100..4f7b3d70a 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -512,6 +512,15 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
return $blocks;
}
+ else if ($op == 'configure' && $delta == 2) {
+ $form['user_block_whois_new_count'] = array(
+ '#type' => 'select',
+ '#title' => t('Number of users to display'),
+ '#default_value' => variable_get('user_block_whois_new_count', 5),
+ '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
+ );
+ return $form;
+ }
else if ($op == 'configure' && $delta == 3) {
$period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval');
$form['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.'));
@@ -519,6 +528,9 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
return $form;
}
+ else if ($op == 'save' && $delta == 2) {
+ variable_set('user_block_whois_new_count', $edit['user_block_whois_new_count']);
+ }
else if ($op == 'save' && $delta == 3) {
variable_set('user_block_seconds_online', $edit['user_block_seconds_online']);
variable_set('user_block_max_list_count', $edit['user_block_max_list_count']);
@@ -546,7 +558,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
case 2:
if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully.
- $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, 5);
+ $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, variable_get('user_block_whois_new_count', 5));
while ($account = db_fetch_object($result)) {
$items[] = $account;
}