Display logged in user name and lastname on page

You can always do a var_dump() of $current_user to see what it contains. You’ll see there is a similar property to user_firstname: user_lastname.

You’ll probably want a space between the first and last name, so a small edit should add the last name:

function custom_shortcode_func() {
    ob_start();
    $current_user = wp_get_current_user();
    echo 'Willkommen ' . $current_user->user_firstname . ' ' . $current_user->user_lastname . '<br />';
    $output = ob_get_clean();
    return $output;
}
add_shortcode('current_user', 'custom_shortcode_func');

As you can see you’re already getting the last name and other data, so the tweak just adds a space character and the last name.

error code: 523