I am trying to embed current user edit form in block. Actually I want just to embed some of the newly added fields. I tried to follow this code:

Embed some user profile fields in a block form

But I failed to find the "category", and code does not produce any output except of "save" button.

EDIT: Provided possible solution does not work for me. It does not print custom fields by any means.

  • Try with global $user; $block['content'] = drupal_get_form('user_profile_form', $user); module_load_include('inc', 'user', 'user.pages'); instead of the code mentioned in custom_block_view in the answer. – berramou Jan 7 '19 at 13:16
  • Thank you for response. I tried replacing the $block['content'] from the example as you suggested but still no form got rendered. Only title "Fill your profile" and nothing else. – Lub Jan 7 '19 at 15:14
  • It actually got rendered!! Thanks a lot! I just had to clean the cache. But it refused to render custom fields. Any idea how can I do that? – Lub Jan 7 '19 at 15:30
  • Possible duplicate of Form within a block – leymannx Jan 7 '19 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.