mbr/nickname
Usage
This filter hook enables you to define the WordPress field nickname
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
Parameters | Description |
---|---|
$nickname | Variable containing the current WordPress field value of nickname . |
$first_name | Variable containing the WordPress field value of first_name , which is obtained from the ActiveCampaign contact field first_name . |
$last_name | Variable containing the WordPress field value of last_name , which is obtained from ActiveCampaign contact field last_name . |
$arrCONTACT | Contains an array of the ActiveCampaign contact record fields for the user who just logged in. |
Examples
- Example 1
function my_mbr_nickname_hook($nickname, $first_name, $last_name, $arrCONTACT) {
// In this simple example, we only check if a nickname exist and if not
// we use the first name only.
IF (trim($nickname) == '') :
return ucfirst(trim($first_name));
ENDIF;
return $nickname;
}
add_filter('mbr/nickname', 'my_mbr_nickname_hook',10,4);