plugins/ProfileExtender/class.profileextender.plugin.php
public function Setup() {
      if ($Fields = C('Plugins.ProfileExtender.ProfileFields', C('Plugins.CustomProfileFields.SuggestedFields'))) {
         // Get defaults
         $Hidden = C('Plugins.ProfileExtender.HideFields', C('Plugins.CustomProfileFields.HideFields'));
         $OnRegister = C('Plugins.ProfileExtender.RegistrationFields');
         $Length = C('Plugins.ProfileExtender.TextMaxLength', C('Plugins.CustomProfileFields.ValueLength'));

         // Convert to arrays
         $Fields = array_filter((array)explode(',', $Fields));
         $Hidden = array_filter((array)explode(',', $Hidden));
         $OnRegister = array_filter((array)explode(',', $OnRegister));

         // Assign new data structure
         $NewData = array();
         foreach ($Fields as $Field) {
            // Make unique slug
            $Name = $TestSlug = preg_replace('`[^0-9a-zA-Z]`', '', $Field);
            $i = 1;
            while (array_key_exists($Name, $NewData) || in_array($Name, $this->ReservedNames)) {
               $Name = $TestSlug.$i++;
            }

            // Convert
            $NewData[$Name] = array(
               'Label' => $Field,
               'Length' => $Length,
               'FormType' => 'TextBox',
               'OnProfile' => (in_array($Field, $Hidden)) ? 0 : 1,
               'OnRegister' => (in_array($Field, $OnRegister)) ? 1 : 0,
               'OnDiscussion' => 0,
               'Required' => 0,
               'Locked' => 0,
               'Sort' => 0
            );
         }
         SaveToConfig('ProfileExtender.Fields', $NewData);
      }
   }
public function Setup() {
      if ($Fields = C('Plugins.ProfileExtender.ProfileFields', C('Plugins.CustomProfileFields.SuggestedFields'))) {
         // Get defaults
         $Hidden = C('Plugins.ProfileExtender.HideFields', C('Plugins.CustomProfileFields.HideFields'));
         $OnRegister = C('Plugins.ProfileExtender.RegistrationFields');
         $Length = C('Plugins.ProfileExtender.TextMaxLength', C('Plugins.CustomProfileFields.ValueLength'));

         // Convert to arrays
         $Fields = array_filter((array)explode(',', $Fields));
         $Hidden = array_filter((array)explode(',', $Hidden));
         $OnRegister = array_filter((array)explode(',', $OnRegister));

         // Assign new data structure
         $NewData = array();
         foreach ($Fields as $Field) {
            // Make unique slug
            $Name = $TestSlug = preg_replace('`[^0-9a-zA-Z]`', '', $Field);
            $i = 1;
            while (array_key_exists($Name, $NewData) || in_array($Name, $this->ReservedNames)) {
               $Name = $TestSlug.$i++;
            }

            // Convert
            $NewData[$Name] = array(
               'Label' => $Field,
               'Length' => $Length,
               'FormType' => 'TextBox',
               'OnProfile' => (in_array($Field, $Hidden)) ? 0 : 1,
               'OnRegister' => (in_array($Field, $OnRegister)) ? 1 : 0,
               'OnDiscussion' => 0,
               'Required' => 0,
               'Locked' => 0,
               'Sort' => 0
            );
         }
         SaveToConfig('ProfileExtender.Fields', $NewData);
      }
   }
public function Setup ( ) { if ( $ Fields = C ( 'Plugins.ProfileExtender.ProfileFields' , C ( 'Plugins.CustomProfileFields.SuggestedFields' ) ) ) { // Get defaults $ Hidden = C ( 'Plugins.ProfileExtender.HideFields' , C ( 'Plugins.CustomProfileFields.HideFields' ) ) ; $ OnRegister = C ( 'Plugins.ProfileExtender.RegistrationFields' ) ; $ Length = C ( 'Plugins.ProfileExtender.TextMaxLength' , C ( 'Plugins.CustomProfileFields.ValueLength' ) ) ; // Convert to arrays $ Fields = array_filter ( ( array ) explode ( ',' , $ Fields ) ) ; $ Hidden = array_filter ( ( array ) explode ( ',' , $ Hidden ) ) ; $ OnRegister = array_filter ( ( array ) explode ( ',' , $ OnRegister ) ) ; // Assign new data structure $ NewData = array ( ) ; foreach ( $ Fields as $ Field ) { // Make unique slug $ Name = $ TestSlug = preg_replace ( '`[^0-9a-zA-Z]`' , '' , $ Field ) ; $ i = 1 ; while ( array_key_exists ( $ Name , $ NewData ) || in_array ( $ Name , $ this -> ReservedNames ) ) { $ Name = $ TestSlug . $ i ++ ; } // Convert $ NewData [ $ Name ] = array ( 'Label' => $ Field , 'Length' => $ Length , 'FormType' => 'TextBox' , 'OnProfile' => ( in_array ( $ Field , $ Hidden ) ) ? 0 : 1 , 'OnRegister' => ( in_array ( $ Field , $ OnRegister ) ) ? 1 : 0 , 'OnDiscussion' => 0 , 'Required' => 0 , 'Locked' => 0 , 'Sort' => 0 ) ; } SaveToConfig ( 'ProfileExtender.Fields' , $ NewData ) ; } }
Import from CustomProfileFields or upgrade from ProfileExtender 2.0.
Import from CustomProfileFields or upgrade from ProfileExtender 2 . 0 .