Developer forum

Forum » Development » Unsubscribe users by SQL/API

Unsubscribe users by SQL/API

Nuno Aguiar
Reply

Hi,

 

I need to delete users by SQL and throught the API. How can I achieve this?

 

The API is to integrate users with a custom developement and SQL to manually correct a few hundred situations. Simply removing them from the groups does not seem to trigger the correct action, because they still show up in the module and I need to clear that,

 

Best Regards,

Nuno


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

 

Have a look at the user class:

 

http://developer.dynamicweb-cms.com/api8/#Dynamicweb~Dynamicweb.Modules.UserManagement.User_members.html

 
Nuno Aguiar
Reply

Hi Nicolai,

 

Will the AddToGroup and RemoveFromGroup take into consideration newsletter groups/categories?

 

I had to remove a lot of duplicate user records, and even after deleting them, when I went to the newsletter module, they were still there. The group user count was different in UserManagement and Newsletter v3. Maybe a bug in that version (19.2.9.9)

 

However I noticed that in 8.3.0.4 added (through the interface) a user to a newsletter category/group, and he did not get assigned to the "Newsletter Reciepients"  group, but shows in All Subsbribers in the Newsletter v3 module. Is the Newsletter v3 reciepients really necessary then to identify newsletter subscribers?

 

Nuno

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

 

In newsletterv3 there is a seperate data structure to handle newsletter Groups/categories. In email marketing it is just the normal Groups and users and we do not operate with newsletter Groups and categories as such.

 

So using Newsletterv3, use the Dynamicweb.Compatibility dll - the Dynamicweb.NewsLetterV3 namespace.

 

If using Email marketing, use the users API. You should REALLY use this instead. In email marketing you simply have a field on the user AllowEmails that has to be set to true.

 

BR Nicolai

 

You must be logged in to post in the forum