ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

multiple mailing list subscribe

August 22, 2010 5:09pm

Subscribe [5]
  • #1 / Aug 22, 2010 5:09pm

    techjob

    22 posts

    Is it possible to create a checkbox list of mailing lists and have a user:

    a. subscribe to multiple lists
    b. unsubscribe from multiple lists

    by simply checking and un-checking the appropriate boxes and submitting the form.

    {exp:mailinglist:form list="list1,list2,..."} // list created via php or java
    
    Join our Mailing List
    
    <input type="text" name="email" value="{email}" /></p>
    
    <input type="submit" value="submit" /></p>
    
    {/exp:mailinglist:form}

    any ideas would be great.

    Thanks
    Pete

    Moved to CodeShare Corner by Moderator

  • #2 / Aug 23, 2010 8:27am

    Sue Crocker

    26054 posts

    There’s nothing built into EE to accomplish this, so I’m moving this thread over to the CodeShare Corner.

  • #3 / Jan 27, 2011 2:47pm

    TVC Church

    2 posts

    Is there nothing I can do to allow a site member to select an email newsletter he wants to subscribe to in EE2?

    Thanks,

    Andrew

  • #4 / Aug 03, 2011 3:32pm

    kwarr

    17 posts

    Me too! It is exactly the feature I am looking for

    Kip

  • #5 / Dec 06, 2011 4:04am

    Komtur

    15 posts

    Here is my solution for a multiple list submit:

    1st the template with all lists

    <form id="dummy" name="dummy">
     
     <h1>Newsletter</h1>
    
     <ul id="mailing_lists">
    {exp:query sql="SELECT * FROM exp_mailing_lists ORDER BY list_id"}
            <li><input type="checkbox" name="list_name" value="{list_name}" class="list_names">{list_title}</li>
    {/exp:query}
     </ul>
    
            <input type="text" name="email" value="{if email}{email}{/if}" id="email"></p>
            <input type="submit" value="eintragen" id="newsletter_submit"></p>
    
     </form>
    
    <div id="dynamic"></div>


    2nd

    some jQuery code to handle the requests

    $('input#newsletter_submit').click(function(fx) { 
      
      fx.preventDefault();
      var my_url;
      
      $('input:checkbox:checked.list_names').val(function(index,value) {
        
        my_url = 'index.php/client/newsletter_ajax/' + value + '/' +$('#email').val();
        // alert(my_url);
    
        $.ajax({
         url: my_url, 
         cache: true, 
         success: function(message) {
          $(this).addClass("done");
          $('#dynamic').append(message);
         }
        });
    
      });
    
       
     
     });

     

    and the 3rd part: the above requested ajax template “newsletter_ajax”

    {exp:mailinglist:form list="{segment_3}"}
    <input type="text" name="email" value="{segment_4}" />
    <input type="submit">
    {/exp:mailinglist:form}

     

    Needs some final work:
    The result should be invisible and submitted by default.

  • #6 / Dec 06, 2011 5:06am

    Komtur

    15 posts

    Function:

    Part 1)
    You generate checkboxes with all mailinglists

    {exp:query sql="SELECT * FROM exp_mailing_lists"}

    Part 2)
    Loop with jQuery through all checked checkboxes, and pass the value (name of the list and email address) to ajax requests

    Part 3)
    the AJAX code now generates HTML code to subscribe to the requested lists.


    This works for me.

    Part 4)
    To do: make the via AJAX returned HTML Code invisible and click / submit it automatically

  • #7 / Dec 07, 2011 6:14am

    kwarr

    17 posts

    Many thanks, Komtur, that looks very promising.

    I don’t have your level of skill, so please could you explain where the various chunks of code should be placed?

    Kip

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases