What are the form field values for e-newsletter?

When designing my own sign-up form for e-newsletter, or using a conversion plugin like OptinSkin, which form action and field values are needed to make sign up work?

  • Vaughan

    hiya

    thanks for posting.

    you could try looking at the e-newsletter subscribe widget code.

    function subscribe_widget($show_name = false, $show_groups = true) {
            global $email_newsletter, $current_user;
    
            $groups = $this->get_groups();
    
            if ( $current_user->data && 0 < $current_user->data->ID ) {
                $member_id      = $this->get_members_by_wp_user_id( $current_user->data->ID );
                $member_data    = $this->get_member( $member_id );
    
                if ( "" != $member_data['unsubscribe_code'] ) {
                    $member_groups = $this->get_memeber_groups( $member_id );
                    if ( ! is_array( $member_groups ) )
                        $member_groups = array();
                }
    
                $show_groups = true;
            }
    
            if ( ! $current_user->data || 0 == $current_user->data->ID ) {
                $view = "add_member";
            } else if ( isset( $member_data['unsubscribe_code'] ) && "" != $member_data['unsubscribe_code'] && 0 < $current_user->data->ID ) {
                $view = "manage_subscriptions";
            } else if ( $current_user->data && 0 < $current_user->data->ID ) {
                $view = "subscribe";
            } else {
                $view = "";
            }
    
            $return = '
            <div class="e-newsletter-widget">
                <div id="message" style="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="" />';
            if($view != 'add_member')
                $return .= '
                    <div id="add_member" style="display:none;">';
            else
                $return .=
                    '<div id="add_member">';
            $return .= '
                        <p>
                            <label for="e_newsletter_email">'.__( 'Your Email:', 'email-newsletter' ).'</label>
                            <input type="text" name="e_newsletter_email" id="e_newsletter_email" value="" />';
            if( isset($show_name) && $show_name )
                $return .= '
                            <br/>
    
                            <label for="e_newsletter_name">'.__( 'Your Name:', 'email-newsletter' ).'</label>
                            <input type="text" name="e_newsletter_name" id="e_newsletter_name" />';
            $return .= '
                        </p>';
            if( $show_groups && $groups ) {
                $return .='
                            <h3>'.__( 'Subscribe to:', 'email-newsletter' ).'</h3>
                            <p>
                                <ul class="subscribe_groups" style="list-style: none outside none;">';
                foreach( ( array ) $groups as $group ) {
                    if( ! $group['public'] ) continue;
                        $return .= '
                                        <li>
    
                                            <input type="checkbox" name="e_newsletter_groups_id[]" value="'.$group['group_id'].'" id="e_newsletter_groups_id_'.$group['group_id'].'" />
                                            <label for="e_newsletter_groups_id_'.$group['group_id'].'">'.$group['group_name'].'</label>
    
                                        </li>';
                }
                $return .= '
                                </ul>
                            </p>';
    
            }
            $return .='
                        <p>
                            <input type="button" id="new_subscribe" class="enewletter_widget_submit" value="'.__( 'Subscribe', 'email-newsletter' ).'" />
                        </p>
    
                    </div>';
            if($view != 'manage_subscriptions')
                $return .= '
                    <div id="manage_subscriptions" style="display:none;">';
            else
                $return .='
                    <div id="manage_subscriptions">';
            $unsubscribe_code = isset( $member_data['unsubscribe_code'] ) ? $member_data['unsubscribe_code'] : '';
            $return .='
                        <input type="hidden" name="unsubscribe_code" id="unsubscribe_code" value="'.$unsubscribe_code.'" />';
            if( $groups ) {
                $return .= '
                            <h3>'.__( 'Subscribe to:', 'email-newsletter' ).'</h3>
                            <p>
                                <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 = '';
                $return .= '
                                        <li>
                                            <input type="checkbox" name="e_newsletter_groups_id[]" value="'.$group['group_id'].'" '.$checked.' id="e_newsletter_groups_id_'.$group['group_id'].'" />
                                            <label for="e_newsletter_groups_id_'.$group['group_id'].'">'.$group['group_name'].'</label>
                                        </li>';
                }
                $return .= '
                                </ul>
                            </p>';
            }
            $return .= '
                        <p>
                            <input type="button" id="save_subscribes" class="enewletter_widget_submit" value="'.__( 'Save Subscriptions', 'email-newsletter' ).'" />
                        </p>
    
                        <p>
                            <a href="#" id="unsubscribe" class="enewletter_widget_submit" >'.__( 'Unsubscribe', 'email-newsletter' ).'</a>
                        </p>
                    </div>';
            if($view != 'subscribe')
                $return .= '
                    <div id="subscribe" style="display:none;">';
            else
                $return .= '
                    <div id="subscribe">';
            $return .= '
                        <input type="submit" id="subscribe" class="enewletter_widget_submit" value="'.__( 'Subscribe to Newsletters', 'email-newsletter' ).'" />
                    </div>
                </form>
            </div><!--//e-newsletter-widget  -->';
    
            return $return;
        }

    hope this helps.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.