Using field layouts, substitutions, regex condition on email field in a user list

This tutorial was inspired by this thread.

Use Case Summary

Current situation:

  • A CB powered Joomla website has many users that do not have their own email address.
  • Since Joomla requires that all users have unique email addresses, a series of fake addresses were used to populate the required fields.
  • Fake emails are in the form: 'uniqueid@invalid.cb'
  • CB User List has been created that includes user email address (this means that the email field must be published for profile show and CB configuration must be set to show email addresses -- otherwise the email address will not be displayed as a user list field option)

Use case need:

  • CB User List should not show the fake email addresses but should show any real addresses.

Solution

Navigate to the CB Field Manager and locate the 'email' field. Click for editing and go to the Parameters > Layout tab.

Here you need to populate the 'Userlist Value Layout' area (and probably the 'Profile Value Layout' area) with the following substitution:

[cb:if email=~"/@invalid.cb/"]No-email[cb:else][value][/cb:else][/cb:if]

Relevant Articles

The following articles/content are referenced:

 

Facebook Twitter Google LinkedIn