I have a content module set up to use a razor template and need it to pull data from a field in the user's profile. I can get it to show name, email, etc. with the @Dnn.User.Email format, but I can't get any of the custom profile fields.
I used the helper snippets to try to get the right format - went to the "Dnn user information" drop down, clicked on Profile > AnyValue. It inserted this: @Dnn.User.Profile.GetPropertyValue(${1:City}\)
I do have a city field but that code breaks the template. "error CS1056: Unexpected character '$' at System.Web.Compilation.AssemblyBuilder.Compile()" is the start of the error message on the page.
I tried to change the code in the ending () but no change I made got it to work.
Is that not the code to use to pull the user profile fields? I can't find any other documentation that goes over the profile - just module, portal, tab and user.
I guess the snippet did something wrong - the $-syntax is a placeholder for the editor to let you replace the texts with tab-tab-tab.
Basically you want something like this:
@Dnn.User.Profile.GetPropertyValue("City")
As Joe pointed out, any DNN API will work - Dnn.User is actually the normal UserInfo object of DNN.
If you want to query users etc. you can use the DnnUserProfile data source (https://docs.2sxc.org/api/dot-net/ToSic.Sxc.Dnn.DataSources.DnnUserProfile.html) to create visual queries or using code, and of course you can always just use the normal DNN API.