0

In using drupal 7

1 .Is there any way to get List of logged out users for last 30 mins?
2. can we track browser close ?

1
  • "can we track browser close?" - answer for this is complicated and this topic should rather be asked on Stack Overflow. Long story short HTTP protocol is stateless, so you need to make browser cooperate to track this. And you never really know for sure if it refused to cooperate, user's net simply died or user is still logged in, just inactive.
    – Mołot
    Commented Mar 14, 2014 at 9:06

1 Answer 1

1

Yes you can, you can do it with views go to admin admin/structure/views/view create users views, add filter last acess -30 mintures, you can import below views

$view = new view();
$view->name = 'logout_users';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'logout users';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'logout-users';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'access user profiles';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
/* Sort criterion: User: Created date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'users';
$handler->display->display_options['sorts']['created']['field'] = 'created';
/* Filter criterion: User: Active */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'users';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: User: Last access */
$handler->display->display_options['filters']['access']['id'] = 'access';
$handler->display->display_options['filters']['access']['table'] = 'users';
$handler->display->display_options['filters']['access']['field'] = 'access';
$handler->display->display_options['filters']['access']['value']['value'] = '-30 minutes';
$handler->display->display_options['filters']['access']['value']['type'] = 'offset';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'logout-users';
2
  • And what if last access was over 30 minutes but user did not logout, just went for a meeting and is away for an hour, but will be back, his browser open? Seen my users doing it a lot.
    – Mołot
    Commented Mar 14, 2014 at 9:03
  • You could use Auto Logout drupal.org/project/autologout to make sure inactive users are logged out after 30mins?
    – Collins
    Commented Mar 14, 2014 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.