By tanke on
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
It may sound dumb !
But can you tell me that which file has to be modified ?
You need to modify
You need to modify user.module in the modules directory.
could this be modified to show total posts to a flexinode?
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?
Works with 4.7.4
Just like to add that this still works for 4.7.4. Line number is around 610, though.
Thanks for the tip!
Updated for Drupal v5.x
With the help from above post, here's my custom who's on-line block.. now w/ total registered.
Tested drupal v5.x
Regards,
Czar