Extending Field Types (for developers)

Last updated by Jeroen Dalsem Comments (6)

Since version 4.1 BETA it is possible to extend the field types that can be used when create new profile/group fields.

This can be done by the following code:

// add following to init()

--------------------

$options = array();
$options["show_on_register"] = true;
$options["mandatory"] = true;
$options["user_editable"] = true;
$options["output_as_tags"] = true;
$options["admin_only"] = true;

$fieldtype = "text";

add_custom_field_type("custom_profile_field_types", $fieldtype, elgg_echo($fieldtype), $options);

--------------------

If you want to extend group profile types replace "custom_profile_field_types" with "custom_group_field_types"

At the moment group types only support output as tags and admin only as an option.

The fieldtype is used by input/fieldtype and output/fieldtype so when extending, make sure these fieldtypes are available.

Also make sure this plugin is enabeld when calling the add_custom_field_type function.

  • I know u hav develop a gr8 Profile Manager plugins. I need some sort of help from u.

    You have added fields in the profile of group,file,registration,etc. I'm trying to add fields in the page but i'm stuck on how to do it and where to do it. also there is a point that whatever fields i add are to be reflected in the database so that i see it in the next time.  u have done same with respect to Profile Manager.

    It would be kind enough if u share the idea or help me somehow..

    Regards and thanx,

    dwaipayan

  • gr8 work.

    can u specify how can i increase the no of fields in the page???

    i wanna increase a the fields in the page. kindly give some help...

  • How to add a new type of name(customized input field)  into The 'pulldown' in Replacing Profile fields?

    Is there any way to to add that into that pulldown option list

  • I agree with lingesan. Can that be done manually. I know how to create new profile-fields manually. But, how to add the pulldowns, radio-fields ... etc.

     

    mod/profile/start.php:
    <?php

                    function my_profile_init()
                    {
                            global $CONFIG;

                            $profile_defaults = array (
                                    'description' => 'longtext',
                                    'briefdescription' => 'text',
                                    'interests' => 'tags',
                                    'skills' => 'tags',
                                    'website' => 'url',
                                    'country' => 'text',
                                    'region' => 'text',
                            );

                            $CONFIG->profile = $profile_defaults;
                    }

     

    ?>

    Also, make sure your fields are defined in languages/en.php, such as:
                            'profile:country' => "Country",
                            'profile:region' => "Region",

  • Finaly i got answer with that two person's help Mukherjee and  Jeroen Dalsem

    <!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->

    •  
      • mod/profile/Start.php

      • Add following into function profile_init() {

        $options = array();

        $options["show_on_register"] = true;

        $options["mandatory"] = true;

        $options["user_editable"] = true;

        $options["output_as_tags"] = true;

        $options["admin_only"] = true;

        $fieldtype1 = "lingesan_Text"; specify the file name from input folder

        add_custom_field_type("custom_profile_field_types", $fieldtype1, elgg_echo($fieldtype1), $options);

      • Creating files in input and output folder.

      • Creating separate class file into theme css file. And mention that class file in this input file.

    That is tha way of code for adding different options into pulldown box in replacing profile field..

    friends Share yours different ideas with me....

     

Jeroen Dalsem

Owner of ColdTrick IT Solutions, developing social networking sites for the dutch market