Userfields Plugin for CMF Cotonti 0.9.26
Userfields is a Cotonti CMS plugin that lets you add and manage custom fields in user profiles without altering the main users table. It provides a flexible way to store extra user information, such as phone numbers, social media links, company addresses, and more. All data is stored in separate tables, avoiding modifications to the cot_users table and making it easy to add new fields.
The plugin does not store data in cot_users; instead, it uses its own database tables: cot_userfield_types and cot_userfield_values.
Main Features
- Create and manage custom fields: Admins can add new field types through a simple admin panel interface. Each field can have a unique code, name, and sort order. Supported field types include text, numbers, dates, currency, checkboxes, radio buttons, and dropdown lists.
- Separate storage for field values: Values are stored in dedicated tables, cot_userfield_types and cot_userfield_values, linked to users by their ID. This structure allows easy scaling and adding new fields without touching the main database.
- Profile integration: Fields integrate seamlessly with user profiles and site templates, including user lists, profile pages, articles, store products, forum posts, and more. Display can be controlled via tags or HTML blocks.
- Intuitive admin interface: The admin panel allows adding, editing, and deleting field types. You can configure field parameters such as code, name, and sort order quickly and easily.
- Automatic data saving: Any changes to fields are saved automatically when a user or admin updates their profile.
- Multiple field types: Supports text, numeric, floating-point, date/time, currency, dropdowns, checkboxes, radio buttons, country lists, and number ranges.
- Template display: Field data can be displayed using tags like
{USERFIELDS_FIELD} or {USERFIELDS_CELL_NUMBER}, making it easy to show values anywhere in templates or pages. - Integration with other modules: Fields can be integrated into products, forums, blogs, and other modules using custom tags. Fields can be displayed in loops or individually for full customization.
- Template support: Works with various templates, including profile pages (users.details.tpl), profile edit pages (users.profile.tpl, users.edit.tpl), articles (page.tpl), store products (mstore.tpl), and more.
Field Types
- Text Field — single-line text input.
- Integer — numeric input, e.g., age or quantity.
- Currency — monetary input with proper formatting.
- Float — decimal numbers, e.g., weight or height.
- Text Area — long text input, e.g., address or comments.
- Dropdown List — select one value from a list.
- Radio Buttons — choose one option from several.
- Checkboxes — select multiple options.
- Date/Time — input dates and times.
- Country — select a country.
- Number Range — define a numeric range.
- Checkbox List — select multiple options from a list.
Installing the Plugin
- Download and extract the plugin.
- Upload the userfields folder to the plugins directory on your server.
- Go to the admin panel: Administration > Extensions > Userfields.
- Click Install to activate the plugin.
The plugin will create the required database tables and add sample fields, such as phone number and company name.
Displaying Additional Fields
There are several ways to display field data in templates:
- Automatic display — using loops that output all fields with their values.
- Individual display — using a tag for each field, for fully customized output.
- Preformatted HTML blocks — display all fields in a predefined layout without manually coding each tag.
Additional fields can be displayed on user profile pages, user lists, forum profiles, store products, and articles.
Admin Workflow
Admins can go to Administration → Others → Userfields to see a clear table of all fields. They can quickly:
- Add a new field (specifying code, name, and order).
- Edit existing fields (rename, change type, or reorder).
- Delete fields (all associated user data is removed automatically).
- Reorder fields by changing the number or dragging them.
New fields appear instantly in all user and admin profile forms — no site reload or cache clearing needed. Admins can also edit any user’s profile at any time, and all changes are saved automatically.
User Workflow
Users can edit their profile (Profile → Edit) and see additional fields at the bottom or in a designated area. Fields appear as standard form elements: text inputs, dropdowns, date pickers, checkboxes, etc., depending on the field type.
Users fill out fields (optional in most cases) and click Save. Everything is handled automatically — no extra buttons or instructions. If the admin has designed a public display, users see nicely formatted phone numbers, Telegram icons, company names, cities, and more immediately.
Uninstalling the Plugin
To uninstall, go to Administration > Extensions > Userfields and click Uninstall. All plugin tables and data will be removed.
Support and Documentation
The plugin offers documentation in two languages and a support forum thread from the developer.
Advantages of Userfields over Standard Extra Fields
- Flexibility and scalability: Values are stored in separate tables, making it easy to scale and add fields without altering cot_users. Unlike standard extra fields, which require database changes, Userfields integrates seamlessly into existing site structures.
- Multiple data types: Supports a wide variety of types, including text, numeric, currency, date, country, checkboxes, radio buttons, and more — completely isolated from standard fields, ensuring safety and stability.
- Admin panel management: All field management can be done via the admin interface, without touching code or the database. Standard fields require manual edits.
- Performance and security: Storing fields separately reduces load on cot_users and improves site performance. Standard extra fields can slow down the system with large data sets.
- Flexible display: Fields can be output in any template via tags, allowing customized display across profiles, store products, forums, and more.
- Template support: Works with profiles, products, articles, and forums, making it easy to display fields consistently across the site.
Conclusion
The Userfields plugin is the ideal solution for admins who want to expand user profiles without modifying core data structures.
For example, in dating or freelancer projects, a user profile may need up to a hundred fields — too many for cot_users. Userfields provides the solution.
It makes adding fields, integrating them into templates, and scaling your project simple. Userfields is more flexible, user-friendly, and efficient than standard extra fields.
Source code on GitHub