Skip to main content

mbr/display_name

Usage

This filter hook enables you to define the WordPress field display_name when the user is first created.

Unlike the mbr/role/alternate filter hook, this setting does not get updated each time a user logs. The hook is only called once upon initial login so as not to disturb any other function which may rely on this setting (i.e. BuddyPress, bbPress, BuddyBoss etc.).

Parameters

ParametersDescription
$display_nameVariable containing the current WordPress field value of display_name.
$first_nameVariable containing the WordPress field value of first_name, which is obtained from the ActiveCampaign contact field first_name.
$last_nameVariable containing the WordPress field value of last_name, which is obtained from ActiveCampaign contact field last_name.
$arrCONTACTContains an array of the ActiveCampaign contact record fields for the user who just logged in.

Examples

function my_mbr_display_name_hook($display_name, $first_name, $last_name, $arrCONTACT) {
// In this simple example, we create a "display_name" consisting
// of first name and last name initial only.
return ucfirst(trim($first_name)) . ' ' . strtoupper(substr(trim($last_name),0,1)) . '.';
}
add_filter('mbr/display_name', 'my_mbr_display_name_hook',10,4);