create UserAttribute (StarCommunity 2.4)

Vote:
 

I'm trying to create a new UserAttribute, but it doesn't seem to "stick" in the database. I'm not supposed to manualy add it in the database am I?

I can create it with new SimpleUserAttribute(...), but when I read it later in the code I get an exception saying the Attribute does not exist.

What am I missing?

#24726
Oct 06, 2008 15:32
Vote:
 

Hi Malin!

In StarCommunity 2.4 you are not able to add a UserAttribute from code, you have to add it manually in the database. This is described in "A Programmer's Guide to StarCommunity 2.4" in section "Dynamic User Attributes".

This section states that attributes are stored in

tblUserAttribute

To create a new attribute, add a new row to the table and chose the attribute type id:

0 = Checkbox
1 = DropDown
2 = ListBox
3 = RadioButton
4 = TextArea
5 = TextField

This will cause the admin interface to render the correct ASP.Net control. To make the attribute a multi-choice attribute, add the choices for the added attribute to the

tblUserAttributeChoice 

table and make the connection.

Hope this helps!

//Tom

ps. I will make sure we add this version of A Programmer's Guide to the download section.

 

#24751
Edited, Oct 07, 2008 11:24
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.