Developer forum

Forum » Development » Activating user notification

Activating user notification

Alexandru Ciobanu
Reply

Hello,

Is there any way to get notified whenever a user in DW gets activated?

Thanks,

Alexandru Ciobanu
.NET Developer, Commergent


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Alexandru

You can see the options on creating a user here:

https://doc.dynamicweb.com/documentation-9/users/user-management/extranet/create-profile-manage-subscription

If you setup the user to approve him self, the admin can be notified by filling in the admin notification section - see below.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

In our case, the activation is done by the admin.
We are supposed to execute some custom code upon activation and email the user.

I understand that DW handles the email sent as part of the standard functionality (you have confirmed this on a separate thread). Still, we need to execute the custom code somehow, and only after the user has been activated.

Thank you,

Adrian

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

The approval action triggers a UserOnBeforeSave and UserSaved notification.

And you can combine that with looking for approvalKey in the POST. So if !string.isNullOrEmpty(Request("approvalKey")) and user.Active = true; and user is saved, it is an activation.

Votes for this answer: 1
 
Alexandru Ciobanu
Reply

Hello,

The problem I have with this is that I cannot find the approvalKey in any POST involving user saved. I do not see anything similar to "approvalKey" in the body.
I also tried getting it in the 2 notifications mentioned: var approvalKey = HttpContext.Current.Request["approvalKey "]; but it always comes empty.

What I am trying to achieve is this:

We have a user that is inactive. A backend admin goes to the user -> options -> checks Active -> press Save User.
I want a way to execute custom code when the user went from a state of inactive to active. I want to capture this change.

By the method you described, I am unable to do this. Please advise?

Thank you,
Alex

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Alexandru

That is very different from what we have discussed. I was referring to the activate user feature of the frontend - you are in the backend.

You can take a look at the post that happens in the backend and react to that instead. How that post looks like can be seen in your browser developer tools.

BR Nicolai

 

You must be logged in to post in the forum