View Issue Details

IDProjectCategoryView StatusLast Update
0008242phpList 3 applicationAll Otherpublic20-04-10 03:08
Reporterkyleknapp 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version2.10.2 
Target VersionFuture developmentsFixed in Version 
Summary0008242: Method for Selecting Recipients by Zip Code
DescriptionIt is EXTREMELY important to me to be able to target mail recipients by zip code, and phplist just doesn't have any workable way to do this. So here is a solution. It's not elegant (maybe someone could improve on it?), but it does work.

It requires that you have attributes in your database as:

      'Zip Code' (type: textline)
      'Targeted' (type: checkbox)
      (these can be named anything)

Files attached are:

      targetzip.php (the script that does the job)
      zipcodes.tab (sample list of zip codes to be targeted)
      listattr.php (displays your attributeIDs)

In the attached targetzip.php script, you'll need to change your database login parameters, as well as the following 2 variables:

      $zipcodeattr = "7"; //attributeid for zipcode field
      $targetdattr = "16"; //attributeid for 'targeted' field


These must be replaced with the appropriate attributeid's from your database (CAUTION: if you get these wrong you could erase valuable data. Your attribute definitions are stored in table 'phplist_user_attribute'. You can view it using something like phpMyAdmin, or use the attached quick & dirty script 'listattr.php' to list your user-defined attributes)

Okay, here's how it works: the script 'targetzip.php'

      -first clears all 'targeted' flags from any previous selection, then

      -reads zipcodes from'zipcodes.tab' (the attached sample is a list of all zip codes within 100 miles of Wheaton IL)

      -generates a list of userids matching each zipcode in the list, and

      -sets the 'targeted' flag to 'on' for each user that matches

You can then use your 'targeted' attribute as a mailing criterion.

To determine what zip codes are selected, simply edit 'zipcodes.tab' using Excel or a text editor and re-upload. I use a program called 'Zip Code Distance Wizard' to find zipcodes within a specified radius of my target location.

Hope this helps someone. I'm a total newbie at PHP and mySQL, but I sure learned a lot doing this.
~kyle
TagsNo tags attached.

Relationships

child of 0003292 new plugin API functionality 

Activities

13-10-06 21:44

 

targetzip.zip (3,784 bytes)

michiel

14-10-06 01:07

manager   ~0019932

That's very interesting for sure, and I can imagine it will be useful for other people. Have you posted it in the "mods" forum? If so, can you post the thread here, so it can be monitored?

I think people are more likely to search the forums for contributions like this.

kyleknapp

14-10-06 02:09

reporter   ~0019937

well, actually I posted it first in the "Answers,Howtos" forum at http://forums.phplist.com/viewtopic.php?t=6762 (but for some reason I was not able to upload the attachment there). Hernol suggested I post it here.

Should I post it in the "Mods" forum as well?
~kyle

michiel

14-10-06 02:40

manager   ~0019938

no, that's fine thanks. Just one links into the forums will be sufficient

user3543

23-04-08 20:03

  ~0045676

It is posted on the forum by kyleknapp in the following adress:
http://forums.phplist.com/viewtopic.php?p=46885#46885