michield / phplist-plugin-attributeselect

Segment sending to phpList subscribers based on attribute values
0 stars 2 forks source link

Support more attributes #5

Open aikar opened 10 years ago

aikar commented 10 years ago

Can you please add support for textline and date attributes?

I would love to be able to just say "Attribute = Arbitrary string value" and "Date is Between X and Z" to properly segment my list.

I might end up doing it myself though as I need it urgently but if you can get it in the next few days please let me know.

aikar commented 10 years ago

I have some basic support for text done - can you give me a review of if anything looks wrong here?

https://github.com/aikar/phplist-plugin-attributeselect/commit/7c7d0debffec76fa91ebd479c27884abd28106c8

Though I want to clean up the in () portion to be safer, as right now it doesn't properly support ", but for my simple needs at this time that was fine. Your array version was broken for anything textual since it didn't wrap the values with quotation.

michield commented 10 years ago

well, that's the input side of it. There's more involved to make that work. I suggest you make it work for yourself and then send a PR.

aikar commented 10 years ago

@michield note the 2nd set of changes. You have a default clause in the switch for the SQL side of things, so I relied on that, but that default clause only processed arrays, so thats where the else comes in, and simply does a single entry for the IN statement.

Though, I'll improve that to not do a in (foo) for single statements as i'm sure that will be better for performance.

Can you give me a quick rundown of any gotchas I might run into adding support for this? Such as using $any and $some and such?

michield commented 10 years ago

don't see any 2nd set. can't think of gotchas, apart from make sure to test what you're doing.