Drupal module: User Picture Field - A Brilliant Solution for Styling forms With Display Suite

Updated: 14 October, 2014 seen 6,574

Working with complex Drupal projects I'm always trying to escape much rewrites of existing Drupal built in functionality.

This time I got a clients request to have an user edit form with two level admin: One for username and password information - second for custom user profile fields, like occupation, location, gender e.t.c.

At start I said - well, let's use Profile2 module, to handle this task, but soon I found there are bugs, and we all hate bugs, so I found a brilliant solution how to get rid of Profile2 module, but to keep existing functionality.

Now arrived the another problem - how to display default Drupal user picture ($picture) using Display suite module on two columns. Thing is, there is no problems to display a custom user image field with help of Display suite, but there is problems to display default picture field:

Found this little nice module after of couple of hours investigating how to show user picture next to comments. 

You might wonder - hell, what's wrong with you dude - Drupal has built in picture field for user profiles and it works on comment forms great.

Yes, you are right, Drupal does haves picture field for user profiles.

But it doesn't play's nice in scenarios when you are using Display Suite to style your form - this field just doesn't exist in Display suite. So you cannot put this field in column "two" for example:

Take a look at this post to understand what I'm talking about: Drupal Display Suite Two Columns on User Edit Forms + Image Widget Default Image 

What I actually needed is to have a default user picture field enabled but with option to style it's display with help of Display Suite module, and here comes User Picture Field module:

This module allow you add an image field to user, and show it on user register form, after user register an account, this module will use the fid that upload by image field as user picture's fid.


1, Add a image field to user, for example "field_user_avatar"

2,config this field,and make it show on user register form.

3,install this module, navigate to "admin/config/people/user_picture_field", here you can config the "Machine name of source field that used as user picture"

When user register an account, he/she upload an image through image field "field_user_avatar", this image will be used as user's picture(avatar).


Now this module support Profile2,You must config 'Machine name of source bundle' and 'Machine name of source field that used as user picture'.


Howard Ge

The author can be contacted for paid customizations of this module as well as Drupal consulting and development.


Now - once you have this module installed configure it according to description, keep using Display Suite and everything should work as needed.

P.S. This little nice module solved another problem I'm facing by using Simple FB connect module to allow Facebook users to login in Drupal site.

Simple FB Connect uses default picture field as well for importing a Facebook users picture.

So by having default profile picture field, but with a little bit of extended functionality.

I can only confirm - avoid of rewriting Drupal default behaviour - in most cases you will struck to extend functionality. Look for simple "bridge" connectors.