How to edit a user profile field?
jhsachs - May 15, 2008 - 14:37
I just created a user profile field and confirmed that the field appears in the Add user form. Then I went to set the field in my existing users' accounts, and found that it does not appear in the edit form.
What's going on here? Since the site is in development and the existing accounts are just for testing, I guess I can delete and re-create them, but I can't expect my client to run a live operation that way.

More complex than I thought
I discovered another, more serious aspect to this problem. I can't find a Profile API function that returns the current user's profile.
The API documentation is very little help in this case. No help, really. There's a function named profile_form_profile which looks like it might be what I want, but I have no idea what most of the parameters are for, so I can't even try it and see.
I'll figure out what's in the profile table and read it myself if I have to, but that shouldn't be necessary!
when you created the profile
when you created the profile field you should have specified a category for it. editing the profile, you should see that category listed next to 'Account Settings' under the local tasks (tabs) at the top of the screen. if you click that category link, you don't see the field listed? what 'Visibility' option did you select when creating the field?
(Drupal 5 notes, but i don't think this behavior has changed...)
It's very different
What I see is very different. Either this has changed profoundly in version 6, or something is wrong with mine.
I did. I just checked; it is still there.
I don't see any of that. No "Account Settings," no tabs, no mention of "local tasks," no category names as links.
The central part of the Profiles page is a table with four columns headed: Title, Name, Type, Operations. The first row under the heading gives the category name in plain type (not a link). Second row describes the first (only) profile field.
The form for editing the profile field has no tabs. It has one group of fields named "Field settings," and the first few fields in it are Category, Title, Form name.
There is a field named "Page title" which I left empty because I will not use it (it specifies a title for a profile field browsing page). I tried putting a value in that field, but it made no difference.
it may be that the profile
it may be that the profile admin section has changed dramatically in D6. if so, sorry but i won't be much help as i'm still exclusively using D5.
but just to clarify, by "editing the profile", i meant editing an individual user's profile by e.g. visiting the "My Account" page, then "Edit" (or /admin/user/user -> edit). on that page i see a set of tabs under my user name ("View", "Edit", etc) and a couple of links underneath: "Account Settings" and one for each profile category i've created. if i click the link for a profile category i've created, i can edit the profile field values in that category for the user.
and of course, the layout/visibility is theme specific so (general sanity check) be sure you're using the default theme first.
Different purpose
I understand what you're saying about "editing the profile." In this case it isn't applicable, though, because of the nature of the site and the profile entry. All user accounts will be created by an administrator, who will also set the profile field. Letting a user set it herself would only give her the ability to set it wrong, which would prevent her from doing her work and interfere with the work of others.
This isn't a user profile in the traditional sense. It's functionally identical -- custom information associated with a user account -- so the Profile module ought to do what I need; but maybe not.
right, but you as a
right, but you as a privileged user should be able to edit the field for any given user. the "visibility" setting when creating the field (at least in D5) will determine who else may be able to see/edit the field.
are you as a privileged user still not able to see/edit the field from /admin/user/user -> 'edit' -> profile category link?
It is set to "Public field..."
That's correct. I've uploaded a snapshot of the content area of a typical edit user account form, with an administrative user account, so that you can see exactly what's there. For comparison, here is the corresponding add user account form. Visibility is set to "Public field, content shown on profile page but not used on member list pages." I think that was the fault, and it seemed appropriate.
As I prepared the snapshots I noticed that the "edit" form has fields for setting the user photo and local time, and the "add" form does not. Those differences are not important to me, but they are further evidence of... something. These are built-in fields. I wonder whether they are displayed inconsistently out of the box.
The meanings of the visibility settings are not clear (and, like practically everything in the modules, do not seem to be documented). It appears to me that for my purposes, they make no difference. The most restrictive one, "Hidden... only accessible by administrators, modules and themes," appears to describe the way my site will work, and it's not clear what any of the other settings could do to change that unless they go around adding things to the menu, which "Public field" does not.
...
The secondary tabs for profile categories would be above where your edit user screenshot starts.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
That's the key
OK, that's the key. There are none, and I had no idea that there were supposed to be. I replaced my custom theme with BlueMarine, and then I saw them.
I'm mystified that the theme is making two entire levels of content containers disappear. At first I assumed that I had a stylesheet problem, but I looked at the page source and found that the tags and content for the tabs simply are not there. Have you any clue what I should look for?
...
Hmm... Well, they're secondary tabs, so I think they're just in:
<?phpprint $tabs
?>
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
Yep, found it
Yep, I realized a little while ago that I had probably torn out some "superflouous" print statements without realizing what they were for. That one turned out to be important. It's fixed now.
Thank you for pointing me in the right direction. It would have taken me much longer to figure this out on my own.
...
Oooh, yeah, $tabs are important. Without that you don't get the edit tab on your nodes or a lot of other things. Glad you got it working.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
great!
loooool, same hapened to me, time elapsed = 1h 12m