Resolving DNN Lock-out Due To Profile Field Definitions 

So you modified your user profile fields for your DotNetNuke website and marked a new "Required" field, however you can no longer get into your website.  This has become a very common issue among DNN users and luckly there is a fairly easy way to let yourself back in.  I will discuss in this post the steps needed to modify your profile property declarations to remove a required field so you may login to your site and correct the underlying issue with the property.  Typically this issue is due to either an invalid validation script, a required field that is not displayed, or a list field that doesn't provide valid options.  Below I will provide you the necessary scripts to lookup and update the database and get yourself back in.

Disclaimer

As with all of my blog postings and content provided via this website this information is being provided to you for use at your own risk.  I have tested these scripts on my environment but you are responsible for ensuring that you are modifying the proper information.  If you have any questions or concerns regarding the scripts/information provided here please leave a comment or ask the question in my forum.

First Gather Needed Information

Before we can do the updates you will need to have two pieces of information.  The first is the PortalId of your individual portal, if you are running just one portal this id is typically 0, but if you are unsure you can use the following script to lookup the portal id of your site.

SELECT PortalId,
        PortalName
FROM Portals
Order BY PortalName

The second piece of information that we need is to find the PropertyDefinitionId of the individual profile property that we need to update.  You can use the below query to obtain information regarding a specific property by name, be sure to substitute your portalId in place of the 0 that I have listed in the sample script.

SELECT PropertyDefinitionID,
        PropertyName,
        Required,
        Visible,
        ValidationExpression
FROM ProfilePropertyDefinition
WHERE PortalId 0
    
AND PropertyName like 'City%'

Perform Update(s)

Now that you have the PropertyDefinitionId you can perform the updates to the property to allow yourself access to the site.  There are typically two different scenarios that can lock you out of your site due to the property definitions.  I will provide scripts for each of these below.  First I will provide the script to remove a required field, you can continue to change information on the field after you are able to login that is why we ONLY update the "Required" field.  The script to perform this update is below.  Be sure to substitute your PropertyDefinitionId and PortalId values in place of my values.  I am providing the PortalId value as a double-check to ensure that if the PropertyDefinitionId value is typed incorrectly you will not accidentially update another portal's information.

UPDATE ProfilePropertyDefinition
SET Required 0
WHERE PropertyDefinitionId 27
    
AND PortalId 0

If that was your only problem you should be able to login to your site successfully.  If you specified a "Validation Expression" for a property and need to remove it you can use the below script.  Again you will need to update the scripts with your correct information

UPDATE ProfilePropertyDefinition
SET ValidationExpression = NULL
WHERE 
PropertyDefinitionId 27
    
AND PortalId 0

Conclusion

One of the above scripts should resolve your site login issue.  You will want to be very careful with these scripts to ensure that you only update the property that is causing the problem, otherwise you might be forced to review/reselect all required fields in your portal.

Posted by Mitchel on Thursday, May 10, 2007
 

Comments

Thank you so much for this article. We were looking at restoring our db from a backup when I found this article. It saved us some major headache!!

By P. Lee on Wednesday, October 08, 2008 at 4:12 AM
Click here to post a comment

Disclaimer