+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Approving Users

Approving Users

3 posts, 1 answered
  1. Matthew
    Matthew avatar
    2 posts
    Registered:
    08 Jul 2013
    08 Jan 2015
    Link to this post

    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: http://docs.sitefinity.com/for-developers-users-api#approving-users

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

    Thanks!

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    09 Dec 2016
    13 Jan 2015
    Link to this post
    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
     
  3. Matthew
    Matthew avatar
    2 posts
    Registered:
    08 Jul 2013
    19 Jan 2015
    Link to this post

    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.       

    Answered
3 posts, 1 answered