Developer forum

Forum » CMS - Standard features » Allowing an extranet user to delete own account

Allowing an extranet user to delete own account

Tommy B-Kuhlmann
Reply

I need to allow extranet users to delete or deactivate their profile from frontend. As far as I can see, there is no template tag for that function? If so is there a workaround to make a "Delete profile" in UserManagement?

Best regards
Tommy


Replies

 
Nicolai Høeg Pedersen
Reply

The user management cannot do it by it self.

 

You can create a view in Datalist that says something like:

 

Deactivating:

update accessuser set accessuseractive = false where accessuserid=123

Deleting

delete from accessuser where accessuserid=123

 

Instead of 123 in the SQL you can use Request("userid") which is a possible context variable you can use in datalist module. Then you can publish the view on a paragraph and call the page with userid=123 in the querystring.

 

A Little tricky, I know, but possible.

 

BR Nicolai

 
Rune Hoffmann
Reply

Hey Nicolai!

Has there been any changes, regarding the functionality to let the user delete/deactivate their own account from the frontend?

Im using the extranet module, if that has any saying?

 

Best regards Rune

 
Nicolai Høeg Pedersen
Reply

Hi Rune

No, same situation.

You can also call the API in a Razor template:

Adding this code into the razor template would disable the user and log off redirecting to the page with the specified ID:

if (System.Web.HttpContext.Current.Request["deleteuser"] == "true")
            {
                var user = Dynamicweb.Modules.UserManagement.User.get_Current(Modules.UserManagement.PagePermissionLevels.Frontend);
                if (user != null)
                {
                    user.Active = false;
                    user.Save();
                    System.Web.HttpContext.Current.Response.Redirect("/Admin/Public/ExtranetLogoff.aspx?ID=123");
                }
            }

BR Nicolai

 

You must be logged in to post in the forum