<?php
$user_id = get_current_user_id();
$user_data = get_userdata($user_id); ?>
<div class="rt-entery rt profile-info">
    <div class="main">
        <div class="panel-alert none"></div>
        <form class="rt edit-profile-form rt-relative" action="#" method="post">
            <div class="loader-box none">
                <div class="dot-loader">
                    <div class="dot-item"></div>
                    <div class="dot-item second-dot"></div>
                    <div class="dot-item third-dot"></div>
                </div>
            </div>
            <input type="text" name="user_firstname" class="rt" value="<?php echo (!empty($user_data->first_name)) ? $user_data->first_name : ''; ?>" placeholder="نام">
            <input type="text" name="user_lastname" class="rt" value="<?php echo (!empty($user_data->last_name)) ? $user_data->last_name : ''; ?>" placeholder="نام خانوادگی">
            <input type="email" name="email" class="rt" value="<?php echo (!empty($user_data->user_email)) ? $user_data->user_email : ''; ?>" placeholder="ایمیل" disabled>
            <label for="display-name">نام نمایشی</label>
            <select name="display-name" class="form-control">
                <?php
                $public_display = array();
                if (!empty($user_data->first_name)) {
                    $public_display['display_firstname'] = $user_data->first_name;
                }
                if (!empty($user_data->last_name)) {
                    $public_display['display_lastname'] = $user_data->last_name;
                }
                if (!empty($user_data->first_name) && !empty($user_data->last_name)) {
                    $public_display['display_firstlast'] = $user_data->first_name . ' ' . $user_data->last_name;
                    $public_display['display_lastfirst'] = $user_data->last_name . ' ' . $user_data->first_name;
                }
                if (!in_array($user_data->display_name, $public_display))
                {
                    $public_display = array('display_displayname' => $user_data->display_name) + $public_display;
                }
                $public_display = array_map('trim', $public_display);
                $public_display = array_unique($public_display);
                foreach ($public_display as $id => $item) : ?>
                    <option <?php selected($user_data->display_name, $item); ?>><?php echo $item; ?></option>
                <?php endforeach; ?>
            </select>
            <input type="text" name="user_phone" class="rt" value="<?php echo (!empty($user_data->user_phone)) ? $user_data->user_phone : ''; ?>" placeholder="شماره تلفن همراه">
            <input type="submit" class="rt" value="ذخیره">
        </form>

    </div>
</div>