Support » Plugins and Hacks » [Plugin: Ecampaign] Capture email addresses

[Plugin: Ecampaign] Capture email addresses

  • zactoff


    Hi John,

    Are you supporting this plugin at all?

    I’m hoping to be able to capture the email addresses the users enter in order to add them to a mailing list, could you point me in the right direction in your plugin where I might be able to do this.

    Many thanks,


Viewing 10 replies - 1 through 10 (of 10 total)
  • Bruce


    I’m looking for the same thing.


    Plugin Author john ackers


    zactoff, Bruce

    In 0.80, you’d want to add the necessary PHP to the send() method of EcampaignPetition.class.php. (This method will get moved to EcampaignTarget.class.php, it’s logical home).

    Which mailing lists are you thinking of? I’m happy to add that functionality.

    How do you think unsubscribe (and email address) changes should be handled? Would this be done by email requests?


    Hi John,

    Thanks for the reply.

    I’m using PHP list for mailouts, if you could add a switch that would allow people to be able to add their addresses to a list when they sign a petition that would be fantastic.

    unsubs and email address changes could then be handled by php list.

    Alternativey, just adding the email addresses to a table in the database would be good.

    Plugin Author john ackers


    Three possible approaches:

    a) According to http://docs.phplist.com/ImportUsersInfo you can batch import addresses from an IMAP mailbox (campaignMail receives an email for each completed campaign action) but you might end up including people that haven’t checked an opt in box.

    b) On version >= 0.80, you can access the email addresses using this sql command:

    select visitorEmail from wp_ecampaign_log where checkbox1 and (state=’sent’ or state=’signed’) ;

    I will add this as a CSV view of the ecampaign log in next release.

    c) PHPList doesn’t appear to have an API to allow subscriptions. Might have to use an unofficial route or worse simply push rows into the PHPList database. Is PHPList going to be running on the same host?

    By the way, a better way of hacking into ecampaign is to create a new class say EcampaignPHPList which extends EcampaignTarget, add a send() method (invoked when site visitor sends email to target), call the parent, then add the hook into PHPlist. The benefit is that ecampaign files can be updated without fear of loosing PHPList functionality. Hope this makes sense.


    I think we’re going to go with your last suggestions for now. PHP list is pretty basic, but once a user is signed up they get an ‘options’ page where they can select from available lists to subsribe to, or unsub themeselves.

    Thanks for your help though, a CSV view on your next release would be great.

    I’m always slightly surprised when someone actually replies to these questions on here :c)

    Plugin Author john ackers


    Just to let you know that the CSV view is in the current release 0.81. And subscription to PHPList should be in a release next week.

    Hi John,

    Sorry to keep pestering you :c)

    Am using release .82, looks to have both the find your MP and subscribe to mailing list options, very brilliant indeed, but I can’t see the CSV view anywhere…

    Am just trying to figure out the subscribe to mailing list functionality. When I add a class to the “Subscribe site visitors who opt-in using a checkbox to external email list using this class e.g. EcampaignPHPList” field and hit save, the subsequent options “Parameters passed to instance of class above…” and “Optional third party API Key…” disappear and can only be seen again when the class is removed from the “Subscribe site visitors…” field, and the settings re-saved.

    Is this correct behaviour?

    Also, I am sometimes getting the following error when viewing a new campaing post: “WordPress database error: [Table ‘pen.wp_ecampaign_log’ doesn’t exist]
    INSERT INTO wp_ecampaign_log (state,visitorName,visitorEmail,address,checkbox1,checkbox2,info,postID) VALUES (‘formUpdate’,”,”,”,’0′,’0′,’postID:244 formID:ec8′,’0′)”

    Many thanks,

    Plugin Author john ackers


    The pestering is good!

    The CSV view is a link on the top of the log page wp-admin/tools.php?page=ecampaign-log. You select what you want, bring it up on the page then click on CSV.

    Well i tried putting in EcampaignPHPList” as you typed and it does screw up the rest of the form. The fault is mine because i’m not handling quotes correctly and will fix.

    However if you don’t use any quotes in any of these fields, you should get correct behaviour. That does raise a potential problem if there are spaces in the address of PHPList configFile for example on a windoze host.

    By the way I’m expecting to have to do at least one functionality change/bug fix for the PHPList interface because I am not completely au fait with how PHPList is normally used.

    Ah, sorry, I was a little remiss in my explanation. The class I tried to add was called addToList, not EcampaignPHPList” so I don’t think it’s the quotes that are messing things up.

    When I check the log (now I know where to find it!) there are several entries at the top as follows:

    WordPress database error: [Table 'pen.wp_ecampaign_log' doesn't exist]
    SELECT state, count(*) FROM wp_ecampaign_log GROUP BY state
    WordPress database error: [Table 'pen.wp_ecampaign_log' doesn't exist]
    SELECT checkbox1, count(*) FROM wp_ecampaign_log GROUP BY checkbox1
    WordPress database error: [Table 'pen.wp_ecampaign_log' doesn't exist]
    SELECT checkbox2, count(*) FROM wp_ecampaign_log GROUP BY checkbox2
    WordPress database error: [Table 'pen.wp_ecampaign_log' doesn't exist]
    SELECT postID, count(*) FROM wp_ecampaign_log GROUP BY postID
    WordPress database error: [Table 'pen.wp_ecampaign_log' doesn't exist]
    SELECT count(*) FROM wp_ecampaign_log WHERE 1=1
    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1]
    SELECT id, date, state, visitorName, visitorEmail, postID, checkbox1, checkbox2, info FROM wp_ecampaign_log WHERE 1=1 ORDER BY date LIMIT 20 OFFSET -1

    I’m going to try and get you some money for this from the client (although it won’t be a lot). If you can provide the functionality we need it will help us enormously. You say the pestering is good but I’ll feel better about it if you’re actually getting something in return for the hassle.

    Email me off list if you’d like to discuss, perhaps we can work together to iron out these wrinkles (I used to be in QA before jumping ship to pretend to be a web developer) zaccety (at) gmail (dot) com

    Plugin Author john ackers


    First point, it should be possible to specify other classes. However the corresponding file containing the class must exist , in your case addToList.class.php.

    On your second point, it looks like the ecampaign_log table is missing. It should be fixed if you deactivate and activate the plugin, that normally happens on upgrades.

    Thanks for flagging this, I will add these points to the FAQ and/or readme.html.

    Will email you offline.


Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Ecampaign] Capture email addresses’ is closed to new replies.