Hi,

I’m using CCK fields to build 2 different profiles (nodeprofiles) with different CCK fields per profile.
One profile per role (2 roles). Several of these fields are image fields.

Is it possible to use one of these images as a replacement for the user picture (the one that a user can upload on the user account page - aka avatar) so I can show this replacement picture next to the blog post:
ex. posted by John Daniels, his picture.jpg (preferably with a link to his profile)

Would this cost much overhead? I guess I would have to load the nodeprofile just for this. I was thinking along these lines (warning! possible gibberish):
are we on a blog page? -> who is the user who blogged -> load the profile for his role -> get the cck_image_field

Or should I hack the theme_user_picture function in user.module?

*sigh* Does this make any sense?

I'd prefer not to use the avatar_selection module.

Thanks

Comments

WorldFallz’s picture

Or should I hack the theme_user_picture function in user.module

ACK! you don't actually mean "hack" the user module right? you mean "override" don't you:

lol. Seriously though, checkout those links-- there should be some useful info to help you do what you're looking for.

zywieco’s picture

I already read those links, but (I might be wrong) it seems they all offer tips/snippets for the core profile, not nodeprofile (which makes users nodes).

So what I probably need is a way to adapt $user->picture to use CCK data from a usernode to display next to a blog post.

Thanks for your answer; of course I ment override and not hack ;-) .

WorldFallz’s picture

sorry, sometimes I post in shorthand, lol. Instead of hacking user.module you should override theme_user_picture. Copy the function from user.module to the template.php of your chose theme, rename it to [themename]_user_picture (ie if you use the zen theme, you would name it zen_user_picture) then change it anyway you like. The links I provided were just for some ideas to adapt, but you can make it do anything you want.

does that make better sense?