I need to Make a Custom Sign Up Form for eNewsletter

Team WPMU,

I need to make a custom sign up form for enewsletter that I can place in a page. It needs to gather a first name, and email address, and allow them to select one (or multiple) lists to subscribe to.

I realize that the shortcode does this. However, as I've said before many times, the shortcode only serves to confuse the heck out of members -- they want to see the name and email fields, not just a "subscribe to newsletters" button.

I have the basic HTML form that allows for name and email -- however, I don't see a method for the list selection.

Thanks,
Rob

  • Michael Bissett

    Hey @jetmac, Michael here! :slight_smile:

    Looking inside lines 2501-2515 of:

    e-newsletter/e-newsletter.php

    This would be the code that e-Newsletter uses to display the groups available:

    <ul class="subscribe_groups" style="list-style: none outside none;">';
                foreach( (array) $groups as $group ){
                    if ( isset($member_groups) && in_array($group['group_id'], $member_groups) )
                        $checked = 'checked="checked"';
                    else
                        $checked = '';
                    if(!isset($only_public) || ($only_public && $group['public']) || !$only_public)
                        $return .= '
                                        <li>
                                            <input type="checkbox" name="e_newsletter_groups_id[]" value="'.$group['group_id'].'" '.$checked.' id="e_newsletter_groups_id_'.$group['group_id'].'" class="e_newsletter_groups_id_'.$group['group_id'].'" />
                                            <label for="e_newsletter_groups_id_'.$group['group_id'].'">'.$group['group_name'].'</label>
                                        </li>';
                }
                $return .= '
                                </ul>

    The thing would be to adapt this code, and manually insert the group IDs and names in the appropriate places in the HTML code. It would take some tinkering to do it, but it does seem possible. :slight_smile:

    Let me know if this helps please!

    Kind Regards,
    Michael

  • jetmac

    Michael,

    I was hoping you could help me put together an HTML form, a variation of what Maniu had put together in another post and what is used in Upfront.

    This is what I have so far, but the member group selections aren't recording:

    <form action="http://shout.thedigitalcomic.com/thanks/" method="post">
    <input name="newsletter_action" type="hidden" value="new_subscribe" />
    <label for="name">Your Name</label>
    <input id="name" name="e_newsletter_name" type="text" style="width:300px" />
    <label for="email">Your Email Address</label>
    <input id="email" name="e_newsletter_email" type="text" style="width:300px" />
    <br>
    
    <h3>Choose Your Genre</h3>
    <input id="group-sf" name="e_newsletter_groups_id" value="2" type="checkbox"/>Science Fiction<br>
    <input id="groups-rom" name="e_newsletter_groups_id" value="3" type="checkbox"/>Romance<br>
    <br>
    <input type="submit" value="Submit" /></form>
  • Michael Bissett

    Hey @jetmac,

    Having had some extra time, I was able to cook this up for you (with inspiration from the code for e-Newsletter):

    <div class="e-newsletter-widget">
                <div id="message" style="color:#000000; display:none; background-color: #FFFFE0;border-color: #E6DB55;margin: 5px 0 15px;-moz-border-radius: 3px 3px 3px 3px;border-style: solid;border-width: 1px;padding: 5px;"></div>
    
                <form action="" method="post" name="subscribes_form" id="subscribes_form">
                    <input type="hidden" name="newsletter_action" id="newsletter_action" value=""><div id="add_member" class="e-newsletter-widget-screen">
                        <p>
                            <label for="e_newsletter_name">Your Name:</label>
                            <input type="text" name="e_newsletter_name" id="e_newsletter_name" style="width:300px">
                            <br>
    
                            <label for="e_newsletter_email">Your Email:</label>
                            <input type="text" name="e_newsletter_email" id="e_newsletter_email" value="" style="width:300px">
                        </p>
                            <h3>Choose your Genre</h3>
                            <p>
                                </p><ul class="subscribe_groups" style="list-style: none outside none;">
                                        <li>
    
                                            <input type="checkbox" name="e_newsletter_groups_id[]" value="2" id="e_newsletter_groups_id_2" class="e_newsletter_groups_id_2">
                                            <label for="e_newsletter_groups_id_2">Science Fiction</label>
    
                                        </li>
                                        <li>
    
                                            <input type="checkbox" name="e_newsletter_groups_id[]" value="2" id="e_newsletter_groups_id_3" class="e_newsletter_groups_id_3">
                                            <label for="e_newsletter_groups_id_3">Romance</label>
    
                                        </li>
                                </ul>
                            <p></p>
                        <p>
                            <input type="button" id="new_subscribe" class="enewletter_widget_submit" value="Subscribe">
                        </p>
    
                    </div>
    
                </form>
    </div>

    Here, I'm assuming that the IDs for your Science Fiction & Romance groups are 2, & 3, respectively (given the values noted in the input fields in the "Choose Your Genre" section).

    Let me know if this helps please! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.