Changeset 1297

Show
Ignore:
Timestamp:
11/20/07 13:44:59 (1 year ago)
Author:
ewout
Message:

Profile fields can now have a default_access attribute. This attribute is set to PRIVATE (in the profile.config.php that ships with elgg) for adresss, home phone and cell phone. Closes #163.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/profile/profile.config.php

    r1046 r1297  
    2121         
    2222        $obj = new stdClass; 
    23                                                 $obj->name              // Description 
    24                                                 $obj->internal_name     // Short / unique internal name 
    25                                                 $obj->field_type        // Type of field 
    26                                                 $obj->description       // User instructions for entering data 
    27                                                 $obj->user_type         // Type of user that can see this field 
    28                                                 $obj->required          // True/false: whether field is required 
    29                                                 $obj->category          // Category field sits in 
    30                                                 $obj->invisible         // If true, won't display except on edit screen 
    31                                                 $obj->registration      // Will appear on user registration 
     23        $obj->name              // Description 
     24        $obj->internal_name     // Short / unique internal name 
     25        $obj->field_type        // Type of field 
     26        $obj->description       // User instructions for entering data 
     27        $obj->user_type         // Type of user that can see this field 
     28        $obj->required          // True/false: whether field is required 
     29        $obj->category          // Category field sits in 
     30        $obj->invisible         // If true, won't display except on edit screen 
     31        $obj->registration      // Will appear on user registration 
     32        $obj->col1              // If true, will appear on the profile, first column 
     33                                // otherwise, only on the extended profile 
     34        $obj->default_access    // if $CFG->default_access = 'PUBLIC', set this 
     35                                // to 'LOGGED_IN' or 'PRIVATE' to force a field to default to 
     36                                // 'LOGGED_IN'. This is to avoid users making things 
     37                                // public by mistake. 
    3238        $data['profile:details'][] = $obj; 
    3339 
     
    7480                                                                    "invisible" => false, 
    7581                                                                    "required" => false, 
     82                                                                    "col2" => true, 
    7683                                                                    )); 
    7784        $data['profile:details'][] = (object)(array( 
     
    8491                                                                    "invisible" => false, 
    8592                                                                    "required" => false, 
     93                                                                    "col2" => true, 
    8694                                                                    )); 
    8795 
     
    110118                                                                    "required" => false, 
    111119                                                                    "user_type" => "", 
     120                                                                    "default_access" => 'PRIVATE', 
    112121                                                                    )); 
    113122        $data['vcard:profile:adr'][] = array("streetaddress","vCard:Street","collated","enclosed"); 
     
    194203                                                                    "required" => false, 
    195204                                                                    "user_type" => "", 
     205                                                                    "default_access" => 'PRIVATE', 
    196206                                                                    )); 
    197207        $data['foaf:profile'][] = array("homephone","foaf:phone","individual","resource"); 
     
    219229                                                                    "col2" => true, 
    220230                                                                    "user_type" => "", 
     231                                                                    "default_access" => 'PRIVATE', 
    221232                                                                    )); 
    222233        $data['foaf:profile'][] = array("workweb","foaf:workplaceHomepage","individual","resource"); 
  • devel/profile/profile.class.php

    r1030 r1297  
    241241                $value = ""; 
    242242                $value->value = ""; 
    243                 $value->access = $CFG->default_access; 
    244             } 
     243                if(isset($field->default_access)) { // default access can be set on a per profile field basis 
     244                  $value->access = $field->default_access; 
     245                } else { 
     246                  $value->access = $CFG->default_access; 
     247                } 
     248            } 
    245249        } else { 
    246250            $value = ""; 
    247251            $value->value = $data['profile:preload'][$fname]; 
    248252            if (!isset($data['profile:preload:access'][$fname])) { 
    249                 $value->access = $CFG->default_access; 
     253              if(isset($field->default_access)) { 
     254                $value->access = $field->default_access; 
     255              } else { 
     256                $value->access = $CFG->default_access; 
     257              } 
    250258            } else { 
    251                 $value->access = $data['profile:preload:access'][$fname]; 
     259             $value->access = $data['profile:preload:access'][$fname]; 
    252260            } 
    253261