• Resolved JanDieckmann

    (@jandieckmann)


    Hello,

    another question: Is it possible to fill the (name and email) fields automatically with the user’s data if an logged in user opens the subscribe form? So that there is only the need to hit the button and not to enter the known data again.

    Bye.

Viewing 6 replies - 1 through 6 (of 6 total)
  • @jandieckmann

    I’m afraid it would not be possible as of now.
    Do let me know if you need any help further.

    I have solved this problem by copying the html form, editing it and set in in a template file. The subscribe page has that pagetemplate.

    
      <div>
          <form class="es_shortcode_form" data-es_form_id="es_shortcode_form">
            <div class="es_lablebox"><label class="es_shortcode_form_name">Naam</label></div>
            <div class="es_textbox"><input name="es_txt_name_pg" class="es_textbox_class" id="es_txt_name_pg" type="text" maxlength="225" value="<?php
              global $curren_tuser;
              get_currentuserinfo();
              echo $current_user->display_name;
              ?>"></div>
            <div class="es_textbox"><input name="es_txt_email_pg" class="es_textbox_class" id="es_txt_email_pg" style="" type="hidden" maxlength="225" value="<?php
              global $curren_tuser;
              get_currentuserinfo();
              echo $current_user->user_email;
              ?>"></div>
            <div class="es_button"><input name="es_txt_button_pg" class="es_textbox_button es_submit_button" id="es_txt_button_pg" onclick="return es_submit_pages(event, 'https://thomasatsea.nl/blog')" type="button" value="Abonneren"></div>
            <div class="es_msg" id="es_shortcode_msg"><span id="es_msg_pg"></span></div>
            <input name="es_txt_group_pg" id="es_txt_group_pg" type="hidden" value="Nieuw bericht">
          </form>
        </div>
    

    It works. You have to edit it where you need. I haven hidden the email-form and group.

    @tkreeft

    I’m glad that has worked for you on your end.
    Do let me know if you need any help further.

    Thread Starter JanDieckmann

    (@jandieckmann)

    Finally I took the time to take a closer look. Thanks for your approach. @tkreeft

    So far as I understood your template is made for a page with nothing else than the form, right? Or can I use it also inside a page with different text before and after?

    @jandieckmann
    Sorry for the late respond, I didn’t saw your reaction.

    Here is the single page template I used. (Now I have an another solution, but I works):

    
    <?php
    /*
     * Template Name: Name of template, visible is the UI
     * Template Post Type: page
     */
    
    get_header(); ?>
    
    	<section id="primary" class="content-single content-area">
    		<main id="main" class="site-main" role="main">
    
          <?php while ( have_posts() ) : the_post();
    
    				get_template_part( 'template-parts/content', 'page' );
    
    				comments_template();
    
    			endwhile; ?>
    <!--The form for subscription. Directly below the page content, above the footer. -->
        <div>
          <form class="es_shortcode_form" data-es_form_id="es_shortcode_form">
            <div class="es_lablebox"><label class="es_shortcode_form_name">Naam</label></div>
            <div class="es_textbox"><input name="es_txt_name_pg" class="es_textbox_class" id="es_txt_name_pg" type="text" maxlength="225" value="<?php
              global $curren_tuser;
              get_currentuserinfo();
              echo $current_user->display_name;
              ?>"></div>
            <div class="es_textbox"><input name="es_txt_email_pg" class="es_textbox_class" id="es_txt_email_pg" style="" type="hidden" maxlength="225" value="<?php
              global $curren_tuser;
              get_currentuserinfo();
              echo $current_user->user_email;
              ?>"></div>
            <div class="es_button"><input name="es_txt_button_pg" class="es_textbox_button es_submit_button" id="es_txt_button_pg" onclick="return es_submit_pages(event, 'https://thomasatsea.nl/blog')" type="button" value="Abonneren"></div>
            <div class="es_msg" id="es_shortcode_msg"><span id="es_msg_pg"></span></div>
            <input name="es_txt_group_pg" id="es_txt_group_pg" type="hidden" value="Nieuw bericht">
          </form>
        </div>
    
    		</main><!-- #main -->
    	</section><!-- #primary -->
    
    	<?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    

    I hope this is useful for you.

    • This reply was modified 6 years, 7 months ago by tkreeft.
    Thread Starter JanDieckmann

    (@jandieckmann)

    Oh, thanks a lot for your effort.

    But I have to apologize too for not withdrawing the question.

    The concept of the website I asked for has changed in the meantime and now this issue is handled otherwise.

    I hope your work will be still useful for others or for me sometime in the future. At least I know where to have a look when I encounter the template issue again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Auitomatically fill fields’ is closed to new replies.