Format any field any way you wish

Custom or Pluggable functions are available for the formatting of any field in a report, One can create one’s own function  if none exist. The plugin will check for one with the right name for the field and use it if it exists.

 

The file  auser-pluggable.php has many examples, as do some of the custom add-ons.

Steps:

  1. Get the technical name of any field from the “nicenames” settings.
  2. Add “ausers_format_” to the front -this is your function name.
  3. Your function can receive the field value and a user object.
  4. Your function should return the html you want to have shown in the field.
  5. Save the function as a site specific plugin to avoid overwriting your function with an update. Copy a plugins plugin header, change the details so wp does not get confused.

Example: here “nice name” is given a link to the users url if it exists.

if (!function_exists('ausers_format_user_nicename')) {
 function ausers_format_user_nicename($v, $u) {
 if (!empty($u->user_url))
 return ('<a href="'.$u->user_url.'">'.$v.'</a>');
 else return ($v);
 }
 }

 

About anmari

the developer at http://anmari.com
This entry was posted in amr users (lists), amr users documentation. Bookmark the permalink.