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.

How to limit Send to Mailing Lists population?

May 14, 2009 9:47pm

Subscribe [1]
  • #1 / May 14, 2009 9:47pm

    oregonshooter

    5 posts

    I have a blog/group/mailing list setup for each subgroup on the website that has a corresponding admin group.  I setup the admin group to be able to use the COMMUNICATE section to allow sending newsletters to their groups, but by default EE lists all the available mailing lists on the SEND EMAIL page.

    Question:  Is there anyway to limit the list to just the lists the admin is a member of via group settings? 

    I don’t think there is, so my next question is where would I look to insert a conditional on the list loop in the code?


    What I’m trying to avoid is one admin emailing other lists by accident or spamming them.

    Thanks for any suggestions…. I’m off to find the list population code now. 😊

  • #2 / May 15, 2009 1:42am

    oregonshooter

    5 posts

    OK, here is my work around in case someone else wants to do this.  Please let me know if you guys have a better way?

    By default EE allows anyone with access to the mailing list to see ALL of the lists.  To limit access to one list I add a field to the exp_mailing_lists TABLE called list_admin_id and compare it to the current SESSION ID in system/cp/cp.communicate.php at line 419

    Result is they see only the list of the group they are a member of.  Since members can’t be in more than one group yet in EE this is were I stopped.

    SuperAdmins retain all lists on their screen.

    Changes are in BOLD

          if ($DSP->allowed_group(‘can_email_mailinglist’) AND $this->mailinglist_exists == TRUE)   
          {

    if($SESS->userdata['group_id'] != "1")
    {
    $my_session_id = $SESS->userdata['group_id'];
    $query = $DB->query("SELECT list_id, list_title, list_admin_id FROM exp_mailing_lists WHERE list_admin_id = $my_session_id ORDER BY list_title");
    }
            else
            {

    $query = $DB->query("SELECT list_id, list_title FROM exp_mailing_lists ORDER BY list_title");
    }
           
            if ($query->num_rows > 0)
            {
              $r .= $DSP->table(‘tableBorder’, ‘0’, ‘’, ‘300px’).
                  $DSP->tr().
                  $DSP->td(‘tableHeading’).
                  $DSP->qdiv(‘itemWrapper’, $LANG->line(‘send_to_mailinglist’)).
                  $DSP->td_c().
                  $DSP->tr_c();

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

ExpressionEngine News!

#eecms, #events, #releases