• Resolved tgilber007

    (@tgilber007)


    Hi I hope you are doing well

    I created a logged in form submission using forminator. How to display a message to logged out users like “You must be logged in to submit the form”

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @tgilber007 !

    I hope you’re doing well!

    Unfortunately at the moment there’s no message displayed by default, but we have a workaround snippet to help with that.

    Here’s the code:

    <?php
    
    add_action('wp_footer', function() {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
      setTimeout(function() {
        if(!$('.forminator-custom-form').hasClass('.forminator-ui')) {
          $('.forminator-custom-form').append('<p>You must be logged in to fill this form.</p>');
        }
      }, 250);
    });
    </script>
    <?php
    });

    To install the code, simply copy it to a file and place the file in wp-content/mu-plugins/forminator-login-message.php

    There are some things you can adjust there as well:

    – 250 – that’s the number of milliseconds the script will wait before adding the message appears – you may want to tweak this a bit in some cases, though 250 should be okay
    – ‘.forminator-custom-form’ – you can be more specific here and also add something like .page-id-123 where 123 is the id of the page with the form, this will limit the scope of the script

    Please let us know in case you need any further assistance with this.

    Warm regards,
    Pawel

    Thread Starter tgilber007

    (@tgilber007)

    Yeh I am Fine
    one small issue the Message appears after the user logged in.

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello there @tgilber007

    Can you please give us an example?
    Is there a login form on the same page?
    Please advise!

    Also, the following version should be a safer approach so feel free to replace the snippet:

    <?php
    add_action('wp_footer', function() {
    ?>
    <script type="text/javascript">
    (function($) {
      $(document).ready(function () {
        setTimeout(function() {
          if(!$('.forminator-custom-form').hasClass('.forminator-ui')) {
            $('.forminator-custom-form').append('<p>You must be logged in to fill this form.</p>');
          }
        }, 250);
      }); 
    })( jQuery );
    </script>
    <?php
    },999);

    Thank you,
    Dimitris

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘log in message’ is closed to new replies.