Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I tried to theme my user_pictures with a Imagefield in a profile.
After creating this user-picture.tpl.php :
print $content_profile->get_variable('profile', 'field_userpicture');
i get the following error:
Fatal error: Call to a member function get_variable() on a non-object in /sites/all/themes/multiflex3/user-picture.tpl.php on line 21
Is the content-profile in this template not included? How do I theme user pictures?
Comments
Comment #1
MichelleThat will only work where the variable $content_profile is defined. Looks like it's not defined in that template.
Michelle
Comment #2
a.siebel CreditAttribution: a.siebel commentedThat's right.
I solved the problem manually:
My user-picture.tpl.php with imagecache support:
?>
(My user pictures are saved in user_pictures/uid )
In content_profile.module in line 558 i added the user_picture.tpl.php to the supported template functions
Comment #3
DarrellHQ CreditAttribution: DarrellHQ commentedSo because you have to enable user picture support and pictures in post and comments for this to work it will also show an extra form on the user edit page. Anyway of getting around the whole thing and theming it to only use the field from content profile.
Comment #4
drumnjo CreditAttribution: drumnjo commentedsubscribing