I have code for setting values into several custom properties. The code works on child portals for the user role intended.
The custom properties are for who donations are paid to for a fund raiser (created on a child portal) . That is, the child portal is the fund raiser and these are made programmatically by persons in a Sales Rep Role or Admins.
When portals are made and the Chair Person is set up and they will run the fund raiser on the portal. Obviously they're in a given role. When the module for setting these properties is used on the child portal they can set/get them. But we asked ourselves what if this Pay To info is available at sign up time? Why not put it in then?
The settings do get created. But when we try to write to them from Portal 0, just after creating the portal, the chair person and the custom properties, it isn't working. Here is the method ultimately called, with skin message entries before and after the Set properties. The txtPayToName and txtPayToAttnTo are arriving in the method. The set properties code works when this module is used from a child portal for a user in the role for Chair Persons.
I'm thinking it's an environment thing. When the user gets created, their profile is set up at time of portal creation those properties are set. The custom properties, from what I know, have to be created after the portal itself is. But apparently they cannot be populated from Portal 0, only from the portal for which they're set up?
If that conclusion is right, is there a way to code around it?
Thanks!
public void AddChairPayToInfo(UserInfo ui)
{
if (ui != null)
{
PrivateAddChairPayToInfo(ui);
}
}
private void PrivateAddChairPayToInfo(UserInfo ui)
{
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "", "Prior to setting profile, user and portal are: "
+ ui.Username + " " + ui.PortalID.ToString()
+ " Pay To Org and Person are: "
+ txtPayToName.Text
+ " and "
+ txtPayToAttnTo.Text,
ModuleMessage.ModuleMessageType.BlueInfo);
//The basic profile property values
ui.Profile.SetProfileProperty("PayToName", txtPayToName.Text);
ui.Profile.SetProfileProperty("PayToStreet1", txtPayToStreet1.Text);
ui.Profile.SetProfileProperty("PayToStreet2", txtPayToStreet2.Text);
ui.Profile.SetProfileProperty("PayToCity", txtPayToCity.Text);
ui.Profile.SetProfileProperty("PayToState", txtPayToState.Text);
ui.Profile.SetProfileProperty("PayToZip", txtPayToZip.Text);
ui.Profile.SetProfileProperty("PayToAttnTo", txtPayToAttnTo.Text);
ui.Profile.SetProfileProperty("PayToPhone", txtPayToPhone.Text);
UserController.UpdateUser(ui.PortalID, ui);
DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "", "After setting profile, user and portal are: "
+ ui.Username + " " + ui.PortalID.ToString()
+ " Pay To Org and Person are: "
+ ui.Profile.GetPropertyValue("PayToName")
+ " and "
+ ui.Profile.GetPropertyValue("PayToAttnTo"),
ModuleMessage.ModuleMessageType.BlueInfo);
}