<?php
add_action ("ws_plugin__s2member_during_configure_user_registration_front_side", "my_custom_name_handler");
function my_custom_name_handler ($vars = array ())
{
if (($user_id = $vars["user_id"]) && !empty ($_POST["s2member_pro_authnet_checkout"]["custom_fields"]["child_name"]))
{
// Get full name of Child, this will be used on the account.
$full_display_name = esc_html ($_POST["s2member_pro_authnet_checkout"]["custom_fields"]["child_name"]);
// Break full name apart at the first space in the full name, to get a first/last name.
list ($first_name, $last_name) = preg_split ("/ +/", $full_display_name, 2);
// Update this new account, using the name that I collected with Custom Reg Field ID: `child_name`.
wp_update_user (array ("ID" => $user_id, "first_name" => $first_name, "last_name" => $last_name, "display_name" => $full_display_name));
}
}
?>
Statistics: Posted by Jason Caldwell — October 1st, 2011, 9:28 pm
Statistics: Posted by Cristián Lávaque — September 26th, 2011, 2:48 pm
Statistics: Posted by Bruce C — September 12th, 2011, 7:28 pm
Statistics: Posted by MODassic — September 12th, 2011, 1:54 pm