Startseite
  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche
Startseite › Forum › Drupalcenter.de › Module › Modulsuche ›

benutzerbild in navi

Eingetragen von Anonymous (0)
am 04.03.2011 - 21:32 Uhr in
  • Modulsuche

Hallo ich suche einen PHP Code oder noch besser ein Modul womit ich im Navigationsmenü unterhalb des Benutzernamens das dazugehörige Benutzerbild angezeigt wird.

Hab ein paar codes ausprobiert.
Dieser englischsprachige User hatte das haargleiche Problem.

siehe hier:

Zitat:

User Pictures Above Navigation Block
Posted by GorillaSushi on January 22, 2007 at 5:42pm

I am looking to display the logged in user's picture above their name in the navigation block.

I'm using a theme based on box-gray. Currently the logged in user's name appears above the main navigation block. I would like the user's avatar to appear directly above it. User's who are not logged in would see the anonymous avatar.

I tried creating a block using...

<?php
 
if ($picture) {
    print
$picture;
  }
?>

but that didn't work. Would I need to find the PHP that already displays the name and and a snippet above it?

Thanks in advance
Jason - www.gorillasushi.com
Login or register to post comments ⋅ Categories: Theme development,
Drupal 4.7.x

Comments
could you use Views to make
Posted by nickmaynard on January 22, 2007 at 6:03pm

could you use Views to make a block and have the filter be the current users picture? and make it only viewable to authenticated users?

Login or register to post comments

might need $user variable?
Posted by krisvannest on January 22, 2007 at 7:06pm

Well i don't know too much about accessing $picture, but it might be that it refers to the picture of the node author, so since there is no node author per-se of navigation block you might have to actually get at it by pulling from the $user variable...

For example, here's some code to display the logged in user's name anywhere in a template:

<?php
 
global $user;
  if (
$user->uid) {print ("Welcome, $user->name");}
  else print (
"Welcome, <a href=\"user\">log-in/join</a>");
?>

Perhaps there's a $user->picture type variable you can try/lookup?

Login or register to post comments

yes, try $user->picture
Posted by krisvannest on January 22, 2007 at 7:11pm

Just tested my above code and looks like it works; thanks for posting the question, too, because now after jotting the code it might be something I use myself. Here's an update of the above, but w/ additional code to display the currently logged in user's pic:

<?php
 
global $user;
  if (
$user->uid) {print ("Welcome, $user->name <img src=\"$user->picture\">");}
  else print (
"<center>Welcome, <a href=\"user\">log-in/join</a></center>");
?>

BTW, don't forget you need to escape any quotes you want to print via a PHP command by putting the \ just before them, as I did here.

Login or register to post comments

Perfect! Thanks!
Posted by GorillaSushi on January 24, 2007 at 6:41pm

That's exactly what I needed!
My version ended up slightly different...

<?php
 
global $user;
  if (
$user->uid) {print ("<center><br /><img src=\"$user->picture\"><br /><br /></center>");}
  else print (
"<center><a href=\"/?q=user/register\"><img src=\"/images/noavatar.jpg\"></a></center>");
?>

Mine shows only the picture using "br"s to center vertically. Users not logged in see the default avatar (noavatar.jpg) that links to the registration page.

Original - Link

Die in diesem Post aufgeführten Php codes funktionieren sogar, aber die Bilder werden leider nicht immer angezeigt

Keine Ahnung woran es liegt.
Ab und zu logg ich mich aus und neu ein und dann funkts wieder mal aber dann zeigt ein anderer browser das bild wieder nicht an.. usw..

Kenn mich mit PHP leider überhaupt nicht aus..
Und mein bissl mit firebug experimentieren hat auch noch keine Früchte getragen.

Ein dementsprechendes Modul würde natürlich auch sehr weiterhelfen.

-fitzpatrick-

‹ Dynamische Seite User mit Rolle Y darf nur Y Beiträge des Typs Z erstellen ›
  • Anmelden oder Registrieren um Kommentare zu schreiben

Benutzeranmeldung

  • Registrieren
  • Neues Passwort anfordern

Aktive Forenthemen

  • Dynamische Ansicht von Seiteninhalt (als Tabelle?)
  • Vergabe von Berechtigungen für bestimmte Rollen; mir fehlt der Haken bzw. das „Veröffentlicht“
  • Ich brauche dringen Hilfe zu Updates oder ggf. wwie geht Composer?
  • Medien und andere Daten mit Feeds von Drupal 7 auf Drupal 10 migrieren
  • Rolle erstellen nicht zu finden
  • für drupal11 ein Slider Modul
  • [gelöst] W3CSS Paragraphs Views
  • Drupal 11 neu aufsetzen und Bereiche aus 10 importieren
  • Wie erlaubt man neuen Benutzern auf die Resetseite zugreifen zu dürfen.
  • [gelöst] Anzeigeformat Text mit Bild in einem Artikel, Drupal 11
  • Social Media Buttons um Insteragram erweitern
  • Nach Installation der neuesten D10-Version kein Zugriff auf Website
Weiter

Neue Kommentare

  • Arrrrg. Nix Tabelle :-D /*
    vor 6 Tagen 19 Stunden
  • Textboxen mit Tabelle
    vor 1 Woche 1 Stunde
  • Du sollst ja auch keine
    vor 1 Woche 1 Stunde
  • Theme
    vor 1 Woche 2 Stunden
  • Welches Theme benutzt du
    vor 1 Woche 8 Stunden
  • Mit Responsive Raster hatte
    vor 1 Woche 22 Stunden
  • Hallo Alex,um das Häkchen
    vor 1 Woche 1 Tag
  • Modul view_unpublished
    vor 1 Woche 2 Tagen
  • Modul "override node options"
    vor 1 Woche 3 Tagen
  • Im Grunde ist dass ein
    vor 1 Woche 5 Tagen

Statistik

Beiträge im Forum: 250270
Registrierte User: 20477

Neue User:

  • Robertnobia
  • AltonRaf
  • JeffreyPaf

» Alle User anzeigen

User nach Punkten sortiert:
wla9463
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3857
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 24 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche

Quicklinks I

  • Infos
  • Drupal Showcase
  • Installation
  • Update
  • Forum
  • Team
  • Verhaltensregeln

Quicklinks II

  • Drupal Jobs
  • FAQ
  • Drupal-Kochbuch
  • Best Practice - Drupal Sites - Guidelines
  • Drupal How To's

Quicklinks III

  • Tipps & Tricks
  • Drupal Theme System
  • Theme Handbuch
  • Leitfaden zur Entwicklung von Modulen

RSS & Twitter

  • Drupal Planet deutsch
  • RSS Feed News
  • RSS Feed Planet
  • Twitter Drupalcenter
Drupalcenter Team | Impressum & Datenschutz | Kontakt
Angetrieben von Drupal | Drupal is a registered trademark of Dries Buytaert.
Drupal Initiative - Drupal Association