I'm working on a design heavy site and one of the sections created via the Paragraphs module requires to display the user_register form.

I'm currently doing this in the paragraphs-item--myparagraph.tpl.php file with the following code:

  $form = drupal_get_form('user_register_form');
  print drupal_render($form);

This works for showing the form but the problem is that if there are form validation errors, they don't show. I have read that the issue is rendering the form too late but I can't see how I adapt this to Paragraph entities. I have tried using mytheme_preprocess_entity to pass the form in but I can't render it?


I ran into something similar recently, and I opted for the Block Reference module.

  1. I created a new paragraph called Block Reference

  2. Added a block reference field

  3. Selected "system blocks" as being referable under the field settings

  4. Selected the user login block

and wham bam thank you mam ive got a user login block in a paragraph.

  • Cool, thank you! I ended up just rendering the form in the page template instead but I'm sure this will come in handy
    – nexus_6
    Jul 14 '17 at 15:10

I ended up displaying the form directly on the page instead.


function mytheme_preprocess_page(&$variables) {
    if (drupal_is_front_page()){
        if (!user_is_logged_in()) {
            $form = drupal_get_form('user_register_form');
            $variables['register_form'] = drupal_render($form);


<?php print $register_form; ?>

Your Answer

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

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