OK, Visual Studio 2012 is reporting that
DotNetNuke.Entities.Users.UserController.GetUser(PortalId, UserID, false); is deprecated and the hydrated flag is not used, so I didn't think it mattered.
I did discover an issue with the stored procedure that updates the User Profile table:
(DNN 7.x ONLY from what I can tell)
Stored Procedure: UpdateUserProfileProperty
Below is the CHANGED version.
(In the ORIGNAL version, notice the line: IF @ProfileID IS NULL
-- this will return false if -1 is passed in for ProfileID and no record exists, hence the update fails)
It has to be changed to: IF ISNULL(@ProfileID,0) >0 (SEE BELOW)
ALTER PROC [dbo].[UpdateUserProfileProperty]
@ProfileID int,
@UserID int,
@PropertyDefinitionID int,
@PropertyValue ntext,
@Visibility int,
@ExtendedVisibility varchar(400),
@LastUpdatedDate datetime
AS
IF @ProfileID IS NOT NULL
-- Try the UserID/PropertyDefinitionID to see if the Profile property exists
SELECT @ProfileID = ProfileID
FROM dbo.UserProfile
WHERE UserID = @UserID AND PropertyDefinitionID = @PropertyDefinitionID
IF ISNULL(@ProfileID,0) >0
-- Update Property
BEGIN
UPDATE dbo.UserProfile
SET PropertyValue = case when (DATALENGTH(@PropertyValue) > 7500) then NULL else @PropertyValue end,
PropertyText = case when (DATALENGTH(@PropertyValue) > 7500) then @PropertyValue else NULL end,
Visibility = @Visibility,
ExtendedVisibility = @ExtendedVisibility,
LastUpdatedDate = @LastUpdatedDate
WHERE ProfileID = @ProfileID
SELECT @ProfileID
END
ELSE
-- Insert New Property
BEGIN
INSERT INTO dbo.UserProfile (
UserID,
PropertyDefinitionID,
PropertyValue,
PropertyText,
Visibility,
ExtendedVisibility,
LastUpdatedDate
)
VALUES (
@UserID,
@PropertyDefinitionID,
case when (DATALENGTH(@PropertyValue) > 7500) then NULL else @PropertyValue end,
case when (DATALENGTH(@PropertyValue) > 7500) then @PropertyValue else NULL end,
@Visibility,
@ExtendedVisibility,
@LastUpdatedDate
)
SELECT SCOPE_IDENTITY()
END