Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to set a default profile property value for existing usersHow to set a default profile property value for existing users
Previous
 
Next
New Post
4/18/2012 12:45 AM
 

Hi,

I'm trying to add a custom profile property to users profiles with a default value. This works perfectly if a new user registers, however users that exist before the profile property was created do not get assigned the default value.

I can't ask the users to update this themselves as it is a hidden field that we use to generate certificate numbers and therefore they should have no access to it.

My problem is that there is no default value or no record in the UserProfile SQL table for existing users with a new profile property.

Is there any way (SQL / Module / other) that I can automatically or manually bulk update existing users to a default value?

I've trolled through pages and pages of google but I can't find anything that seems similar to what I'm trying to do. Any advice or a nudge in the correct direction would be massively appreciated!

Thanks

 
New Post
4/18/2012 2:53 AM
Accepted Answer 

AFAIK exising users will get the new default value assigned, when they update their user profile. You may create the value in userprofile table using SQL in Host menu:

Lookup propertydefinitionId (replace yourPropertyName with your value and modify portalId if needed):

SELECT [PropertyDefinitionID]
  FROM {databaseOwner}[{objectQualifier}ProfilePropertyDefinition]
  WHERE [PropertyName] LIKE 'yourPropertyName' AND [PortalId] = 0

now you may insert your new values for all users, who don't have a value already (modify portalId if needed):

MERGE INTO {databaseOwner}[{objectQualifier}UserProfile] P 
  USING {databaseOwner}[{objectQualifier}UserPortals] U ON (P.UserID = U.UserId AND P.PropertyDefinitionID = 17)
WHEN NOT MATCHED THEN INSERT (UserID, PropertyDefinitionID, PropertyValue, Visibility, LastUpdatedDate)
 VALUES (U.UserID, 17, 'Your Default Value', 1, GetDate());

You'll need to restart the application to reload all user objects.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
4/18/2012 3:50 AM
 

Thank you, this works perfectly! You've saved me many hours of headache :-)

 
New Post
11/7/2013 1:07 PM
 
Yes. This is a great query. Thanks for sharing!
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to set a default profile property value for existing usersHow to set a default profile property value for existing users


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out