By prattboy on
I'm stumped. How the heck do I display the currently logged in user's profile image? I'm trying to add this to a block that shows for authenticated users and everything I try just doesn't display anything at all.
I'm stumped. How the heck do I display the currently logged in user's profile image? I'm trying to add this to a block that shows for authenticated users and everything I try just doesn't display anything at all.
Comments
<?php echo $picture; ?> or
echo $picture;orecho theme("user_picture", $user);For a block I stuck this in the php textarea of a new block:
and tick "authnticated users" to get it to show only to auth users.
Hope I deciphered the question correctly :)
works at bekandloz | plays at technonaturalist
Don't need php tags on every line
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Apologies, terrible editing
Apologies, terrible editing on my part :)
works at bekandloz | plays at technonaturalist
But for clear explain..
in line 2 the ?> is wrong.
ps: sorry my poor english.
correct, but
I noticed another small boo-boo: there are no spaces in
$user->name.Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Drat, I habitually put
Drat, I habitually put spaces in things like that as it's easier for me to read and it hasn't complained yet.
I'd stop coding in the middle of the night if it wasn't the only time I had to do it :)
works at bekandloz | plays at technonaturalist
Excellent! Works great;
Excellent! Works great; thank you.
question
is ist possibel to have this:
user avatar
make content
my account
admin..
and all my other custom links
is this possibel if so how can i do that?
Greetz Demon
Yes; try creating a block
Yes; try creating a block that is visible only to authenticated users that contains php markup similar to this:
It's very, very important that the filter you use is PHP and not HTML or filtered HTML.
This works great for current
This works great for current logged in user.
How could this be modified to show the last 5 users who've logged in? Using views for something like this seems to intensive maybe?
thanks!
Try this
This should be pretty close to what you want. Note that the query excludes anonymous (user/0) and superuser (user/1).
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
This almost works Nancy, it
This almost works Nancy, it does display the last user names but because I have my file download method set to private it fills in the base path as :
//home/user/files/pictures/picture-3.gif
instead of as:
http://domain.com/system/files/pictures/picture-3.gif
so my pictures don't end up displaying. What do I use to modify this string?
if ($user['picture']) { $output .= '<img src="/'. $user['picture'] .'"/><br/>'; }How can I get it to just output the user's picture file name so that I can just add this?
<img src="http://www.domain.com/system/files/pictures/'. $user['picture'] .'"/><br/>'; }I'm not sure how to change this
$user['picture']to get just the picture-3.gif file name to be added to the end of the img src url.Thank you very much for your help.
Try this
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
Works!
Thank you so much for that and the
basename($user['picture'])part would've left me stumped for days.I ended up using the following code which generates the file path automatically so I don't have to hardcode it.
Thanks again for your help : )
having pictures of new users
Hi,
I had a look through the user module and couldn't seem to find the bit of code that spits out the most recent people who have joined the site.
I wanted to create a block that shows little pictures of the people who have recently joined the site instead of just a link with their name (as shown in the default block).
Any help would be great.
Cheers,
Sarah
I can't tell you
I can't tell you to hack a core module. But perhaps you can find a way to make the "theme_user_list" do what you want. Supposedly this can be modified in your site's theme.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
php mysql
thanks a lot i have used most of your tutorials and they have been very helpful
though i can't display an image to currently logged in user in my system please assist.
like the way face book does it
i have a database with the user's pictures and i need to display indiviual pictures to the user after
logging in thank you.
Where
I'm getting kind of tired of people thinking that Facebook should be imitated.
Where are these pictures in your database? Standard Drupal is to enter them into your user record at sign-up or later by editing your account. The url of the picture is then saved in the specific user's row in the User table of the database. If it is not, then you'll have to provide a hook_user('load',...) function in a module.
NancyDru
image
where should i paste the above script specified
-=[o]=-
The ones that don't go into blocks probably go in a *.tpl.php.
works at bekandloz | plays at technonaturalist