Who is online in domain access I am developing a website with Domain Access. Each domain has the same structure but different content. I would like to show online users. When I activate who's online block from block list in admin, it will display all online users. But, I want to display the 'online user' for a particular domain.

I use Domain Strict module so users login only their assigned domain.

How can I show 'online user' of a particular domain using Who's online block.
Domain Strict - Forces users to be members of domains in order to view content.


So they are still logged in to the whole system, that's what other modules can see.

The best you can do is to create your own module, or use PHP module to create a block with PHP filter. Use code similar to the one from this Drupal.org post:

// Count users with activity in the past defined period.
$interval = time() - 900;

// Perform database queries to gather online user lists.  We use s.timestamp
// rather than u.access because it is much faster is much faster..
$anonymous_count = sess_count($interval);
$authenticated_users = db_query('SELECT u.uid, u.name FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp &gt;= %d AND s.uid &gt; 0 ORDER BY s.timestamp DESC', $interval);
$authenticated_count = db_num_rows($authenticated_users);

// Format the output with proper grammar.
if ($anonymous_count == 1 &amp;&amp; $authenticated_count == 1) {
  $output = t('There is currently %members and %visitors online.', array('%members' =&gt; format_plural($authenticated_count, '1 user', '@count users'), '%visitors' =&gt; format_plural($anonymous_count, '1 guest', '@count guests')));
}
else {
  $output = t('There are currently %members and %visitors online.', array('%members' =&gt; format_plural($authenticated_count, '1 user', '@count users'), '%visitors' =&gt; format_plural($anonymous_count, '1 guest', '@count guests')));
}

echo $output;


Now you have 2 modifications to make:


Get rid of the whole "anonymous" part, as you don't need it.
Modify the $authenticated_users = db_query part to JOIN the table Domain Strict module uses, and only count users that have access to the current domain.