I've benn made a hack to show the total registered users in the who's online block.

1. Modify the line (approx.) 552, and add below $guests = db_fecth....

 $somos = db_fetch_object(db_query('SELECT COUNT(uid) AS count FROM {users}'));

2. And now, change the output format conditional block (line 556 approx.) to:

   // Format the output with proper grammar.
   if ($total_users == 1 && $guests->count == 1) {
      $output = t('We are %totales and there is currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests'), '%totales' => format_plural($somos->count, '1 user', '%count users')));
  } else {
     $output = t('We are %totales and there are currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests'), '%totales' => format_plural($somos->count, '1 user', '%count users')));
  }

That´s all, enjoy.

Comments

Ricky’s picture

But can you tell me that which file has to be modified ?

vigo-1’s picture

You need to modify user.module in the modules directory.

maui1’s picture

I want to create a very simple snippet. I want to display the total number of posts to a flexinode I have created and display it in a block.

A second snippet I would like to create would show the numeric average of the contents of a single field in my flexinode. eg If there are ten posts to the flexinode, this snippet would add all the contents of the numeric field and then return the average.

This code looks like it might lend itself to doing this

Could anyone help me get started on creating a 'Node Count" snippet or a "Field Average" snippet?

eddanx’s picture

Just like to add that this still works for 4.7.4. Line number is around 610, though.

Thanks for the tip!

czarphanguye’s picture

With the help from above post, here's my custom who's on-line block.. now w/ total registered.

Tested drupal v5.x

$somos = db_fetch_object(db_query('SELECT COUNT(uid) AS count FROM {users}'));
            $output = t(' <div style="color: #000;"><ul><li>%totales registered</li><li>%members online</li><li>%visitors online</li></ul></div>', array('%members' => format_plural($authenticated_count, '1 user', '@count users'), '%visitors' => format_plural($anonymous_count, '1 guest', '@count guests'), '%totales' => format_plural($somos->count, '1 user', '@count users')));

Regards,

Czar