Skip to content
Snippets Groups Projects
Commit e21c0c65 authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#40535 by Wesley Tanaka. Configurable number of user for the "Who's new" block.

parent 48bbf720
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -512,6 +512,15 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { ...@@ -512,6 +512,15 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
return $blocks; 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) { 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'); $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.')); $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()) { ...@@ -519,6 +528,9 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
return $form; 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) { else if ($op == 'save' && $delta == 3) {
variable_set('user_block_seconds_online', $edit['user_block_seconds_online']); variable_set('user_block_seconds_online', $edit['user_block_seconds_online']);
variable_set('user_block_max_list_count', $edit['user_block_max_list_count']); 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()) { ...@@ -546,7 +558,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
case 2: case 2:
if (user_access('access content')) { if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully. // 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)) { while ($account = db_fetch_object($result)) {
$items[] = $account; $items[] = $account;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment