Welcome to Elgg's documentation

This is the place to find documentation on all aspects of Elgg. If you would like to contribute your own documentation please do; we want this to be a real community effort!

Profile Changes - Adding/Changing fields

From Elgg Documentation

How to change the profile data collected (domain.com/profile/edit.php) and displayed (domain.com/username/profile.php) by editing /mod/profile/profile.config.php

1. You can change this completely without reservation. Make it your own!

2. This is the only file you need to edit unless you introduce a new type (case) of field. To change or add field types (cases) you edit /lib/displaylib.php. It may be that field types (cases) specified in /mod/blog/lib.php may be called upon from the profile.config.php as well.

3. The database structure of elgg does not need to be changed to add or subtract or change profile fields. All profile data is stored in the profile_data table in elgg.

4. The English language file does not need to be changed unless you are using other languages. If you are using other languages then you will need to update all the language files for all the new or changed profile fields. The language files are in /languages. Changing language files is covered elsewhere.

5. Open /mod/profile/profile.config.php in your favorite editor. You will see a list of array sets that look like this:

 $data['profile:details'][] = (object)(array(
 "name" => __gettext("Profile photo"),
 "internal_name" => "profilephoto",
 "field_type" => "profile_photo",
 "description" => __gettext("Photo to display at the top of your   profile."), </nowiki>
 "category" => __gettext("Basic details"),
 "col1" => true, 
 "invisible" => false, 
 "required" => false, 
 "user_type" => "",
));

6. Each one of these sets of data specifies one field. We will demonstrate how to convert the Profile Photo field above to Favorite Movies. Copy that set and paste it where you would like your Favorite Movies field to appear. Perhaps you will put it just below the Introduction (Who Am I).

"name" => __gettext("Profile photo"),	

Change "Profile photo" to "Favorite Movies"

"name" => __gettext("Favorite Movies"),	

then go to

"internal_name" => "profilephoto",	

and change “profilephoto” to “movies”

"internal_name" => "movies",	

then go to

"field_type" => "profile_photo",

and change it to

"field_type" => "text", 

All the available field types will be discussed below.

Next go to

 "description" => __gettext("Photo to display at the top of your   profile."), </nowiki>

and change to

"description" => __gettext("Your favorite movies."), 

The gettext for category determines which tab in edit profile the field appears. The tabs are created on the fly so as many different types of categories you use here is how many tabs you will get. All you have to do to add, usbtract, or change fields is change them here. This does not affect the database at all.

"category" => __gettext("Basic details"),

This field determines if the field appears on the main profile page and if so which column. If this field is left out or is false it will only appear on the extended profile. If it is set as it is below for col1 true then it will appear in the left column of the main profile page. Changing to col2 would make it appear in the right column.

"col1" => true, 

Set invisible to true and the field will not display in the profile regardless of what they put for access restrictions; it will only display in the edit profile section. This is useful if some data you collect is for internal use only.

"invisible" => false, 

Set required to true and this field becomes required.

 “required" => false, 

Leave blank if for user profile and community profile. Or if only for one or the other enter "user" or "community" as is appropriate.

"user_type" => "",

7. The order in /mod/profile/profile.config.php determines the order in which they appear on the data entry and display pages (profile/edit.php). So move them around as you like.

8. To make new ones just copy another one similar and insert it you want it and edit it accordingly.