• Resolved larry.bradley

    (@larrybradley)


    I want to manipulate the newsletter database using my own program. Besides having people subscribe to newsletters, we want to “import” customers from our database into the newsletter subscriber database, based on various criteria, such as courses they have taken in the past. But the import addon doesn’t provide the flexibility we need. I have written a program for our system that lets me manipulate the wp_newsletter table (add/delete/update entries) but I have a few questions:

    1. The “token” field. When adding a new email address, I use the PHP “uniqid()” function. It creates a larger hex field than the plugin does. Is this OK?
    2. The plugin has the ability to give a list a name (e.g. list_1 could be called “Test”). How can I find the name for a list in the WordPress database? (I know how to extract data from the various tables and their fields).
    3. I need the ability to distinguish between people who have subscribed, and those that I have added. For now, I use the country field, since we don’t use geolocation. I think it would be useful to have a couple of user fields in the table, that are not used by the plugin, but could be used by people like me.
    4. How does the newletter subscribe popup know that someone has seen it, so that the popup isn’t displayed again for a period of time?

    I love the plugin … the bounce feature is very usefull, but being able to manipulate the tables externally (as I have described above) will make it a lot better in out particular environment

    Many thanks,

    Larry Bradley Advantage Boating, Ottawa CANADA

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Stefano Lissa

    (@satollo)

    Hi, a few answers.

    Lists can be simply defined from the admin side, giving them a name, or you need to use update_option(…) for the key “newsletter_lists” (it’s an array, WP takes care to serialize and unserialize).

    To mark a subscriber as “imported” I suggest to use a list instead of the country, it’s semantically more correct.

    You can possibly use the subscriber’s metas: we don’t use them too much right now, but it’s an option.

    Stefano.

    Thread Starter larry.bradley

    (@larrybradley)

    Thanks, Stefano.

    I found out where the list names are kept … in the wp_options table. I am able to extract them and display them in my program with their names, if any.

    The reason I don’t want to use a list to distinguish “users” from “subscribers” is that the plugin lets the admin change the list names, add/delete addresses from the lists. But I might look into that. It does, indeed, make more sense.

    The other question was about the token. As I said, I create a token for users I add to the database using the PHP uniqid() function. It seems to work OK. How does the system use that token?

    Also, I asked how the subscribe popup knows not to popup again for the same person each time he connects to our system?

    Thanks.

    Plugin Author Stefano Lissa

    (@satollo)

    The uniqid is ok, or you can use the password generator of WP. The popup uses cookies to track the closing.

    Thread Starter larry.bradley

    (@larrybradley)

    I have everything working fine. Via my program that uses mySQL to manipulate the newsletter data base, I can add and delete people, add or remove them from lists.

    I have some suggestions to make it easier for people like me who want to manipulate the database externally.

    First, it would be useful to have a flag in the database to distinguish subscribers from people added externally. This would not be seen by the plugin users.

    Second, having the list data in a newsletter table rather than in the wp-options table would make life a lot easier for external access. It would then be easier to have more flags for list entries. One flag that would be useful is a “lock” flag. If this flag is set, the list can’t have its name changed via the plugin, and probably its contents can’t be changed either.

    This stuff would only be useful to people like me who have a need to manipulate the newsletter database externally.

    Thanks

    Plugin Author Stefano Lissa

    (@satollo)

    Hi, about the wp_options table this is the standard way to save options so we cannot change that, it would be an extra effort for something that already work well out of box by WP.

    About the flags, you can use the wp_newsletter_user_meta or add a column to the wp_newsletter table: the upgrade process does not remove added columns. Or create a new dedicated table with the user ID and the flag.

    Stefano.

    Thread Starter larry.bradley

    (@larrybradley)

    OK. I can add a column to the newsletter table safely. Good news.

    I don’t think the lists are an option, as you would normally think of options. The email rate (emails/hour) is an option. The lists are actually “tables” in a database sense. There is one row for each list, with the list number, the list name, the list flags as columns. I assume that you read in the list data from the options table at startup, and write it back out when the user changes the name, or one of the flags. Smells like a database table to me! (an aside … I am a database person … that’s what I do))

    If it looks like a duck, walks like a duck, and talks like a duck, maybe it should be a duck!

    Don’t think I am criticizing the plugin … I think it is great. We have been using it quite a lot. The subscription stuff, the way it works, is very clever. Nothing is more annoying than something that pops up every time you connect. I love the mail bounce addition! And I can live with the way the lists work. We are a small company, and we can enforce rules such as “Don’t change the name of the following lists, ever!” I just thought you might look at my ideas to see if they make sense to a wider customer base. I suspect there are a lot of customers who are similar to us. There are subscribers, and then there are others you get in via the import addition, of via database manipulation.

    Just some thoughts. Great product.

    Thanks for discussing these things with me.

    Plugin Author Stefano Lissa

    (@satollo)

    Hi, I know the lists are not managed in a classical way: that is for historical reasons, and changing them now would be very dangerous. ??

    Thread Starter larry.bradley

    (@larrybradley)

    Stefano, I have my upload stuff working just fine now. The newsletter database now has all our customers in it. What happens if someone tries to subscribe via the popup, and their email address is already in the database (i.e. via our upload)?

    Second question, for testing, I want to delete the cookie the popup uses, so I can force the popup to appear. How do I identify the cookie in Chrome’s cookie list? What is the name of the cookie?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.