Is it possible to assign a username to a new user using the First Name + 1st letter of the Surname? Like Robert R., I think I'm in the right direction using http://php.net/manual/en/function.substr.php
but can't get it work. Any suggestions on this are welcome!
<?php
add_filter('gform_username', 'auto_username');
function auto_username($username){
$username = strtolower(rgpost('input_1_3') . $string[0];(rgpost('input_1_4')));
if(empty($username))
return $username;
if(!function_exists('username_exists'))
require_once(ABSPATH . WPINC . "/registration.php");
if(username_exists($username)){
$i = 2;
while(username_exists($username . $i)){
$i++;
}
$username = $username . $i;
};
return $username;
}
?>