Description
This function gets the form fields object for a registration form or user profile form.
Changelog
Introduced in version 3.1.1
Source
wpmem_fields() is located in /inc/api.php.
Notes
wpmem_fields() is the preferred way of retrieving the WP-Members fields array.
wpmem_fields() will return an array of WP-Members fields and their properties. The array will be keyed by the meta key for each field. The associated value will be an array of properties for that field.
All fields will contain the following properties:
- label – the raw text label value for the field.
- type – the field’s HTML “type” attribute (text, email, textarea, checkbox, multicheck, select, multiselect, radio, password, image, file, url, number, date, hidden).
- register – if the field is to be displayed in the registration form (currently indicated by “display”). 1 = display in registration, 0 = admin only
- required – 1 = field is required, 0 = field is not required
- profile – for future development, not currently used
- native – 1 = field is a WP native field, 0 = field is a custom field (not user selectable)
Additional possible properties:
- placeholder – the HTML placeholder attribute for field types that support it.
- pattern – the HTML pattern attribute (i.e. regular expression or “regex”) for fields that support it.
- title – the HTML title attribute for fields that support it.
- checked_value – value attribute for a checkbox
- checked_default – if a checkbox should be checked by default (1 = yes, 0 = no)
- values
- options
- delimiter
As an example, a field with the meta key “first_name” would be in the array as follows:
[first_name] => Array ( [label] => First Name [type] => text [register] => 1 [required] => 1 [profile] => [native] => 1 )