Field types and formats

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.)

Priorities

  1. Custom format specified in settings & custom function for that exists
  2. Else Custom format specified in settings – default pluggable function
  3. Else Linktype with default format
  4. Else Custom pluggable field specific function
  5. Else Default pluggable function if available (no settings, no linktype)

Instructions

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
  • Time
  • Date
  • Ago (human time difference)
  • Age
  • 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.

Email example:

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.

Exclude meta keys, and delete them too

The latest update (3.9) adds a admin screen that allows you to

  • see and change which meta keys are excluded by default from the plugin and
  • exclude more meta keys
  • delete user meta records for selected metakeys (cleanup)
  • see totals of meta records for meta keys

This became essential for anyone using S2member, and handy for anyone using Advanced custom fields which seems to create additional hidden metakeys for every custom field.  Thisplugin will attempt to help you out by default excluding as many unnecessary fields as possible.  You can then update.

The S2member access cap times field is keyed by time, which means that as time goes by there will be more and more sub fields detected by amr-users and the fields and nicenames page will become impossible.

s2member access cap times

s2member access cap times field

This is clearly unworkable.  So a admin page to exclude meta keys was added. This page will also allow you to delete meta records. Be Careful!  This is a confirmation step, but no undo.

excluded meta keys

excluded meta keys

The “find fields and nice names” page has been updated to help highlight what’s going on.

new nice names

updated nice \names