Many fields will have default formats, but what if you want a different format? Or if the field was added by another plugin? There are add-ons for some third party plugins which may offer suitable formats. Alternatively from version 4.0 of amr-users and up, one can control the format via the settings.
Tell the amr-users plugin what sort of data you have in your fields (the fieldtype) and the plugin will offer you some predefined formats for that field. In some cases the option may be greyed out if the format function is not available in the system.
Some formats are available in the free version and some may require amr-users-plus versions >= 3.0 or may require a custom add-ons.
This is for example very useful if dealing with a third party plugin that stores date and time fields as Unix timestamps. (Why do they do this?, ok I know why, it’s just that if wordpress doesn’t do it, it’s not necessary for plugins to do it is it?. It obfuscates the data and makes to hard for you when you look at the raw data.)
- Custom format specified in settings & custom function for that exists
- Else Custom format specified in settings – default pluggable function
- Else Linktype with default format
- Else Custom pluggable field specific function
- Else Default pluggable function if available (no settings, no linktype)
In the “Fields and nice names” screen, select the field type for the field that the plugin has found. For example:
- user registration date is stored in date time format YYYY-MM-DD hh:mi:ss
- various S2 member date time fields are stored in Unix timestamp format
In the “configure list” screen for each list, choose formats that make sense for that field-type. Each list can have a different format. For example, one list might have a high level date format for the user registration date, and another list might choose to include the date and the time.
Date Time fields and Unix time-stamp fields could currently be formatted as:
- Date and time
- Ago (human time difference)
- Birth month
The actual format of the date, time and datetime options can also be customised. The options are the usual wordpress options AND the custom options from your general settings screen.
Usually the user_email field will be formatted with the ‘mailto’ linktype and then each site can tailor this with their own css. Perhaps use wordpress dashicons to show a email icon? Two format options have also been provided. If functions are defined for the format dropdown options, they will become ‘available’. Eg:
- function ausers_format_email_mailto($email) or
- function ausers_format_email_icon_mailto($email)
If a custom format is specified in the settings, these will generally override any coded custom formatting routine (except for amr-users-plus-s2member version 2.0 and lower) and any default formatting.
You should ensure that your data adheres to the field type specified. Any invalid data will generally be shown unformatted.