Skip to content

Instantly share code, notes, and snippets.

@nciske
Created May 4, 2015 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nciske/9092eeda49c7048f766b to your computer and use it in GitHub Desktop.
Save nciske/9092eeda49c7048f766b to your computer and use it in GitHub Desktop.
salesforce_w2l_cc_admin_from_name example
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