By NeilMcEvoy on
Hi there
I'm trying to pull and display elements from the users profile into a side block. I have zero PHP skills, so am guessing my way through, but here's exactly what I've put into the block, but nothing appears:
print $user->name
I guess I'm missing something v basic?
Many thanks in advance,
Neil.
Comments
Please look at the excellent
Please look at the excellent user profile snippets by Dublin Drupaller for possible solutions:
http://drupal.org/node/35728
Quick one..
Hi Neil,
It's not clear if it's the visitors profile details you want to put in a block or for example, if you are looking at someones blog, their profile info appears in a block.
Eitherway, I think the key to it would be the
Profile_load_profile($account)function...Click for an example of an "about me block" that onlyt appears when someone is looking at their blog.
hope that helps
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
could be perfect
Hi Dub
Yeah, I'd like to display a synopsis of a user in a right block when one of their blogs is displayed. Their picture, few basic details, link to profile etc.
If the about me block example does this it is perfect, thank you very much! :-)
Stupid question: Can I just cut and paste from the example?
Many, many thanks,
Neil.
I haven't tested it
Hi Neil,
I haven't tested it, but you should be able to (I just edited it to correct a typo I spotted).
Follow these steps:
$account->countryfield. for the users COUNTRY. make sure it matches your profile fields. I tend to name them with the profile prefix, so my profile field variable would read$account->profile_countryhope that helps
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
quick one
here's a simplified version of that block snippet...tested in Drupal 4.7. beta3 (it also should work with 4.6)
that should be more intuitive to follow and to edit, or extend.
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
an error
Hi Dub
Many thanks for this help. Unfortunately I'm getting an error, so I must be have followed it wrong a wee bit. Here's the error:
Parse error: parse error, unexpected $ in /home/mcevoyn/public_html/sandbox/includes/common.inc(1857) : eval()'d code on line 11
And here's my code:
Have I done something wrong somewhere?
Thanks again,
Neil.
try this
you were missing a
}in one of your lines.Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Ah yes
So I was. And it kinda stands out too!
However hasn't worked. No error now, but it just doesn't display anything, just a blank space.
Thanks, Neil.