How to add <select> type fields to profile

I have created at a plugin to add some custom fields in the registration form. Some of these fields are dropdowns  (<select>... <option></option> ......</select>) . But I'm not sure how to display these new fields into the "Profile" tab so users can change them later.  Any ideas how I can add them to the profile tab?

I've already tried following this: to remove the defaults ones and add the new ones, but was not able to add the values with dropdowns.

  • Why not use Profile Manager, as this plugin is made for this purpose

  • @jerome  Very nice plugin, it seems to do most I need. I however am looking to do it in a more programatically way, so when I move to the production server I don't have to run the fields setup again, and neither other developers when installing it locally.  You know if there's any way to setup this plugin programatically? 

  • There is no way to do it programatically, however you can export the field config and import it on another site. So that's a thing

  • Thanks @jerome ! I'll keep this idea as backup. The reason why I'm not using it just yet is that in this project, a specific user type has to have some fields available, and other user types have a different sets available, and in the registration form we are "hiding" and "showing" fields depending on selection. So in order do manage this part I think is easier to keep the project's own plugin idea for now. 

    The main problem I'm facing now is just to extend somehow profile to just show a 'dropdown' type.  Open to more suggestions or ways to approach this.  Thanks!

  • Ok, I thought of posting an update in case the information is useful to someone. The way I solved this was by creating a custom input type under "view/default/input/mycustomtype.php" with the <options> I needed. Then i just specified the type of input as "mycustomtype" when needed, or called it through elgg_view('input/mycustomtype'). 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking