esroyo / oc-userprofile-plugin

Add user profile fields to October CMS front-end users.
GNU Lesser General Public License v3.0
6 stars 5 forks source link

Drop down field in the backend forms required #8

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello Carles,

Thank you for your fantastic User Profile plugin! It is so charming and generic that it belongs to core of OctoberCMS.

I have fields based on Location plugin having country, state and city fields in the users table that stores their respective IDs, like country_id, state_id and city_id of that user. Here, I have an extra Tab named Region. The same could be to have different other Tabs.

In the admin, these fields are directly populated, which means they are not relational. So, the data values are shown as the ID of that country/state/city. But these fields are dependent and needs to do the following:

1) It should create a drop down. 2) It should fetch the value from the location tables and display their Labels.

That means that your generic coding needs to be extended a little bit by adding a new field type with certain additional parameters and making it relational or dependent.

Further, the backend form to display the fields is a one page form that displays all the fields. If possible, it would be helpful to make an overview of all the additional fields created by Profile plugin and select only that particular field for making a change.

Also, deleting a field function is missing.

Another feature that would really make your plugin extra-ordinary would be to have different tables for each profile, like users_profile_private, users_profile_business, etc.

Would you be interested to have some of these modifications? These enhancement would be in the interest of the community.

ghost commented 7 years ago

Hello Carles,

I found out that the above feature request of Location mapping and drop down is already implemented in the Plugin User Plus+ by Rainlab.

In the profile page, the Plugin User Plus+ displays the real name of countries and states.

Whereas the Plugin User Profile shows their IDs.

Because this feature is already implemented in the User Plus+, it should not be a lot of work to implement this.

However, if - and when - you implement this, it would be really great if you could also consider implementing the feature of display + edit of other tables, not just Location plugin.

Because User Plus+ is static and provides pre-configured fields and your plugin has already taken a very generic approach to creating and updating fields, it would be helpful, if you could maintain this generic approach by mapping fields to tables in a generic manner, that is just not limited to Location table.

This means I want to create a drop down field. Then I choose the table. Thereafter, I could choose field. Then the Plugin User Profile saved the ID/Label to be generated in the create/update forms.

This method also applies to updating tables. If one could choose which table fields needs to be updated, then one could create new tables and update them directly from the User Profile table.

Thereafter, one could have separate tables, like for social profile, business profile, private profile, job profile, etc.

esroyo commented 7 years ago

Hello SchneiderDe,

First, please forgive me for taking so long to answer your suggestions.

My comments on them:

  1. I agree that having a list of profile fields as a first step before editing each field individually is a nice UI improvement. It's absolutely needed if you have lots of profile fields. +1
  2. About "deleting a field". On one hand, just deleting the field from the configuration is possible by clicking on the X (top right) of the field and Saving. On the other hand It is true that the field is not removed from the database. I'm not sure if it is best to add a checkbox to confirm database column removal on the delete dialog, or just remove the column directly. Any thoughts?
  3. This plugin is a fork of RainLab.UserPlus --as you noted-- to make it more "generic". The modifications over the original plugin are few. But the one thing that I dislike the most and would love to change is the place where profile fields data is stored (having it on the users table is a really bad idea). The User Profile data should be stored in its own table. I'm not sure if you are suggesting to have a separate table for each profile tab. If that is the case, I think it is a bit oversized. Just a separate table for all the profile fields data would be enough to me.
  4. A dropdown profile field type would be a great addition. We could store the dopdown options in a table with two columns id, name as a convention. Then that approach would be compatible with the RainLab.Location tables or other already existing tables. As you suggested, that list of options would be always editable from User Profile. I guess for something as generic as this, allowing multiple selection drop-downs is desirable.

Thanks a lot for your time.