<?php
namespace Wpupgrader\Libraries\WordPress\Plugins\Core\Settings\Page\Callback;

use Wpupgrader\Libraries\WordPress\Plugins\Core\Settings\Page\Callback;

class User extends Callback
{
    public function callbackAction()
    {
        $functionsargs = isset($this->args['functionargs']) ? $this->args['functionargs'] : [];
        $users = \get_users($functionsargs);

        echo '<select '.$this->getNameIdString().'>
		    		<option value="">- Selecteer een gebruiker -</form>';

        foreach ($users as $user) {
            $selected = ($this->settings->options[$this->args['name']] == $user->id) ? ' SELECTED' : '';
            echo '<option value="'.$user->id.'"'.$selected.'>'.$user->display_name.'</option>';
        }
        echo '</select>';
        echo $this->getDescription();
    }
}