Block "wer ist online" nur Gäste anzeigen möglich?
am 25.11.2012 - 16:48 Uhr in
Hallo Leute,
ich möchte unter "wer ist online" die eingeloggten User raushaben oder zumindest die Namen, so das die Anzeige beschränkt ist auf
zur Zeit sind 4 Benutzer online.
Ich finde keine hilfreichen Antworten per Google, habe schon user visits und visitors probiert, aber das trifft es alles nicht.
Hat jemand einen Hinweis auf die passende .tpl oder ein ähnliches Modul, wäre super....
Viele Grüße Jenna
- Anmelden oder Registrieren um Kommentare zu schreiben

Ich denke
am 25.11.2012 - 19:17 Uhr
das kanst du doch in der Block Konfiguration einstellen.
oder mit php in der Block Konfig
oder mit Kontext
das läßt sich nicht in der
am 25.11.2012 - 20:14 Uhr
das läßt sich nicht in der Blockconfig einstellen, hast du zu php oder Kontext vielleicht auch ein Beispiel?
so ist das wenig hilfreich.
Grüße Jenna
Meine Frage an Google
am 25.11.2012 - 20:30 Uhr
Die Frage lautet so > show user online block only for registred user on drupal > warum nicht gleich Google Fragen frage ich mich
http://drupal.org/node/618490
If you have a block that you want to set visible only for logged in users, follow these easy steps:
Go to Administration -> Build -> Blocks page;
Select "Configure" link next to the name of the block that you want to set visible only for logged in users;
After the page reloads scroll down to the "Page specific visibility settings" field, select "Show if the following PHP code returns TRUE (PHP-mode, experts only)" option and paste the following code in the field "Pages" showed below the selection options:
<?phpglobal $user;
return (bool) $user->uid;
?>
To display the block only for anonymous users use the following code:
<?phpglobal $user;
return !(bool) $user->uid;
?>
Note: to use this method the PHP filter module must be enabled!
vager Hinweis
am 26.11.2012 - 10:38 Uhr
Hallo Jenna, einen vagen Hinweis hätte ich schon - vielleicht kann dann einer der Cracks hier weiterhelfen.
Es geht um die Funktion theme_user_list($variables) die man im Kontext des 'User online'-Blocks anpassen müsste.
Würde mich jetzt auch interessieren, wie hier die beste Vorgehensweise ist.
hatte die Frage falsch verstanden
am 26.11.2012 - 11:14 Uhr
kommnt schon mal vor :)
Danke oteno das ist schon ein
am 26.11.2012 - 11:19 Uhr
Danke oteno das ist schon ein guter Schubs in die Richtung, habe diesen Link dazu gefunden und fange mal an zu tüfteln:
http://api.drupal.org/api/drupal/modules!user!user.module/function/theme_user_list/7
Wenn ich was brauchbares hinbekomme melde ich mich, vielen Dank
Grüße Jenna
ist zwar alt könnte aber helfen
am 26.11.2012 - 11:23 Uhr
Last updated March 22, 2009. Created by sungkhum on June 1, 2006.
Edited by bryan kennedy, Sloane DellOrto, add1sun. Log in to edit this page.
This is a customization of the "Who's Online" block (it should help you to change whatever else you would like to change as well). This one just adds the total number of registered users in addition to telling who is online.
Drupal 5
<?php
$number = db_result(db_query('SELECT COUNT(uid) AS number FROM {users} WHERE status=1'));
if (user_access('access content')) {
// Count users with activity in the past defined period.
$time_period = variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists.
$guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
$users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
$total_users = db_num_rows($users);
// Format the output with proper grammar.
echo "Out of $number registered users ";
if ($total_users == 1 && $guests->count == 1) {
$output = t('%members and %visitors online.', array('%members' => format_plural($total_users, 'there is currently 1 user', 'there are currently @count users'), '%visitors' => format_plural($guests->count, '1 guest', '@count guests')));
}
else {
$output = t('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')));
}
// Display a list of currently online users.
$max_users = variable_get('user_block_max_list_count', 10);
if ($total_users && $max_users) {
$items = array();
while ($max_users-- && $account = db_fetch_object($users)) {
$items[] = $account;
}
$output .= theme('user_list', $items, t('Online users'));
}
}
return $output;
?>
Moin Jenna,
am 26.11.2012 - 19:50 Uhr
nach Installation von Theme developer-Modul und Simpledomhtml-Modul folgendes festgestellt:
Candidate template files:
block--user--online.tpl.php < block--user.tpl.php < block--postscript-fourth.tpl.php < block.tpl.php
ich würde die core-block.tpl.php als block--user--online.tpl.php im Theme einbinden und entsprechend themen.
Sepp