Approving Users

Posted by Community Admin on 04-Aug-2018 19:16

Approving Users

All Replies

Posted by Community Admin on 08-Jan-2015 00:00

Hi all, I am somewhat new to developing for Sitefinity.  

I need to provide a way for administrators to approve users that have registered on a Sitefinity 7 site.  Ideally, I need to add a button or checkbox to the Edit User Profile screen that sets the value of the User.IsApproved boolean field.  

I am setting the IsApproved flag to false when the user registers, but I can't find documentation on how to allow an administrator to set the flag to true from the Sitefinity backend.  The best documentation I could find is located here: docs.sitefinity.com/for-developers-users-api

What is the recommended way to approve a newly registered user?

Thanks!

Posted by Community Admin on 13-Jan-2015 00:00

Hi Matthew,

Currently, the only way to approve the users (if they have not properly activated their accounts after registration) is by setting the IsApproved property of the user to true using the API. Here is a sample code which you can use to activate an account:

var userMan = UserManager.GetManager("Default");

//you won't need this if you'll be doing it from your site's backend and you already have sufficient privileges to perform this action
userMan.Provider.SuppressSecurityChecks = true;
 
//you can also use one of the other overloads of userMan.GetUser()
var user = userMan.GetUserByEmail("test@test.com");

if
(user != null)
user.IsApproved = true;
userMan.SaveChanges();

I have logged a feature request in our feedback portal on the following link to allow admins to approve the users from the Sitefinity backend. Hopefully we will be able to provide this functionality for our future releases. You can vote to increase the popularity of the feature request.

I have also updated your Telerik points accordingly.

Regards,
Sabrie Nedzhip
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 19-Jan-2015 00:00

Thanks, Sabrie.  I think Sitefinity should have a standard way to mark users as approved, so I voted on adding the feature.

To resolve my issue, I wound up defining my own instance of the UserEditDialog.  This allowed me to use Javascript to set the IsApproved flag to the value of a checkbox I added to the dialog.       

This thread is closed