You are here: ListManager Programmer's Guide > Common SQL Queries > Add a member

Adding a member

 

The members_table stores a row for each list that the member has joined, so the same email address will appear multiple times in this table. Most columns have defaults, so the minimum number of columns can be provided for an insert. You must split the user name and domain portion of the email address prior to inserting a row into this table. The UserNameLC_ field stores the user name in lower case, and the domain should always be in lower case. The EmailAddr_ field stores the email address in mixed cases, and mustbe the same as the UserNameLC_ + @ + Domain_, ignoring case, or ListManager will not work properly.

 

Records can be inserted into the members_ table with a 'needs-' status, such as needs-confirm. ListManager regularly polls new records into the members_ table to see if any of the new members need a hello, confirm, or goodbye document sent to them. The check is only done regularly for new members, so updating an existing member to 'needs-hello', for example, will not cause an immediate document send. Instead, during a nightly check this status change will be noticed and the document sent.

 

Members can be added or marked unsubscribed at any time in ListManager. Postings which have been processed to the point that sending has started will not reflect changes made in subscriptions after that point. So if a posting is created to ten people and it is processed to become an outmail record, when user number eleven is added to the list he/she is not automatically sent the posting, even if the job has not yet completed sending to all recipients.

 

The MemberID_ field is an auto-numbering field, so should never be provided for insert statements.

 

insert into members_ ( EmailAddr_, UserNameLC_, Domain_, List_, MemberType_ )

values ( 'GeorgeBush@example.com', 'georgebush', 'example.com', 'terrorist-watch-news', 'needs-confirm' )