views:

477

answers:

1

Hi all,

I'm very confused about the whole user profile thing in drupal, hope someone can help me out here since I haven't found a clear answer anywhere else.

For starters, where do you set up custom fields for users, is it under 'admin/user/profile' or under 'admin/content/node-type/profile' (with the content_profile Module installed)? I have tried both but only fields that were added in the 'default' user/profile section and set to appear on the registration page actually showed up there. Is it ok to use both or should I stick to using only one?

Once the user is logged in and I go to edit the profile, eg. 'user/1/edit/' no other fields apart from the default ones show up in the resulting form. I can't really imagine that I have to add them manually in the 'themename_user_profile_form' hook?

Would be cool if someone could help me out here or point me to a resource where this is covered.

Edit: This turned out being the hint I was looking for: http://drupal.org/node/517094 The snipped posted there isn't quite right, what I did was add a new module that hooks into edit_profile_user:

function edit_profile_user ( $op, &$edit, &$account, $category = null )
{
    global $user;
    switch ( $op )
    {
        case 'form':
            return profile_form_profile( $edit, $user, 'Name of the Category' );
    }
}
+1  A: 

There's a lovely page about extending user account information in the docs.

cpharmston
Thanks, but I already went through that. As I said, I can add fields to the registration process using the method described just fine but not on the edit page. As a bonus, profile_load_profile( $user ); does not load the custom fields into the $user object..
Polygraf
Ok, I looked further and finally started getting somewhere. Turns out you have to add your own module that will hook into 'edit_profile_user' where you then have to load profile_form_profile() of the section you added which you can then edit with your 'themname_user_profile_form'. What a hassle..
Polygraf