Created
May 4, 2015 13:54
-
-
Save nciske/9092eeda49c7048f766b to your computer and use it in GitHub Desktop.
salesforce_w2l_cc_admin_from_name example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'salesforce_w2l_cc_admin_from_name', 'yourprefix_salesforce_w2l_cc_admin_from_name' ); | |
function yourprefix_salesforce_w2l_cc_admin_from_name( $name ){ | |
// change to the field names you want to use if not using the built in fields | |
$field_names = array( 'first_name', 'last_name'); | |
$user_name_pieces = array(); | |
foreach( $field_names as $field_name ){ | |
$user_name_pieces[] = $_POST[ $field_name ]; | |
} | |
// convert to string and remove trailing/leading spaces | |
$user_name = trim( implode( ' ', $user_name_pieces ) ); | |
// if it's not blank, use it | |
if( $user_name ) | |
return $user_name; | |
// otherwise use the value passed in | |
return $name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment