0

I'd like my users to be able to write a bio on their profile page. Therefore, I added a long text field called 'Bio' to the user accounts. I created a view that shows the user's bio and wanted to add a link to only let the user edit his/her bio. Unfortunately, I only found a link that redirects the user to a page where he/she can edit his/her whole profile - which isn't exactly what I want.

Did I miss something?

I tried to solve this in another way. I created a content type called 'Bio' and a rule that creates a 'Bio' node with title My bio automatically when a user is created. Users don't have permission to add another bio, but they can edit their own 'standard' one. Now, I don't want the title field to be displayed on the edit form, because I'd like the titles to remain My bio.

How can I do this?

1
  • you can use hook_form_alter to hide title in second option. Nov 17, 2013 at 18:56

1 Answer 1

1

Re: the second/existing option, if you have a custom module already, could do a form_alter() on the node form to remove the title field. Or, you could look into the auto_nodetitle module that does this for you:

"auto_nodetitle" is a small and efficient module that allows hiding of the content title field in the form. To prevent empty content title fields one can configure it to generate the title by a given pattern.

When the token module is installed it's possible to use various node data for the auto generated title - e.g. use the text of a CCK field (since 5.x).

Advanced users can also provide some PHP code, that is used for automatically generating an appropriate title.

If instead you wanted to stay/go back to the first option, you could create a menu link/path like user/%/edit/bio that presents the user_profile_form that has been form_alter()ed to show only the bio field based upon the fact that it was called from this new path.

3
  • Which option is the most efficient according to you?
    – Jeroen
    Nov 17, 2013 at 20:40
  • Both ways are pretty much equal efficiency wise. Easewise, the auto_nodetitle should do all you want pretty much "out of the box" without any/much further programming on your part.
    – Jimajamma
    Nov 17, 2013 at 21:13
  • Thanks a lot for your detailed answer. I'm using the Automatic Nodetitles module and it does exactly what I want!
    – Jeroen
    Nov 19, 2013 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.