Developer forum

Forum » Development » Extranet Extended Edit User

Extranet Extended Edit User


Reply

 Hello.

I'm looking for some insight and/or guide lines in how to accomplish this.

We have a setup with extranet extended (dw version 19.1.1.0). I have written a custom sign up/Create user module, so the user can select a Language + Store relationship. This is just 2 groups in the extranet ex. “Denmark” à “Aalborg”.

First off I didn’t really think much about it, I just wrote the custom module for this – but now after doing custom validation etc. for creating a user I maybe think it wasn’t the best approach? Anyway, now the user needs the feature where he can select a new store relationship on his Edit profile page. Here I was thinking about developing an ajax feature to populate the html <select> with the stores (groups) in it, who would call a custom aspx page. Then create a notification subscriber that subscribes to UserSaved and then pick up the form value and do my magic.

One problem here, I have created a subscriber. And as far as I understand I should use the new UserManagement notifications when working with the new dynamicweb and extranet extended. Correct?

 

[Dynamicweb.Extensibility.Subscribe(Dynamicweb.Modules.UserManagement.Notifications.UserSaved)]

    public class SaintTropezEditUserExtender : Dynamicweb.Extensibility.NotificationSubscriber

    {

        public override void OnNotify(string notification, object[] args)

        {

            HttpContext htc = HttpContext.Current;

            htc.Response.Redirect("http://www.google.dk");             

        }

    }

(Cannot find an example http://engage.dynamicweb-cms.com/api/extensibility/ – I think you need to update this.)

But I cannot get this to execute when saving (update user button on edit profile page).

So before starting out I want to know if this approach is what other dw developers would have done or am I totally off track?

Any help, guide lines, best practices, what you would have done I much appreciated.





Replies

 
Nicolai Høeg Pedersen
Reply

I think the problem is your OnNotify.

There are 2 versions - the "old" one where the second parameter is an array of objects holding the parameters for the notifications.

The "new" version allways have a Extensibility.NotificationArgs as the second parameter. That one can then be converted to an inherited type that fits that particular notification for getting a typed version, in this example a Modules.UserManagement.UserNotificationArgs object.

So your OnNotify method should look like this:

public override void OnNotify(string notification, NotificationArgs args){
Modules.UserManagement.UserNotificationArgs a = (Modules.UserManagement.UserNotificationArgs)args;

}

 
Nicolai Høeg Pedersen
 
Reply
Yes this worked! Thank you very much.

 

You must be logged in to post in the forum