Last active
October 23, 2019 12:09
-
-
Save badabingbreda/0afc7663718419a636bc27483f2e29ba to your computer and use it in GitHub Desktop.
Toolbox Docs: Plugin Development Alias Module Settings Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Callback used to return the users of this WP site | |
* @return array | |
*/ | |
function starter_return_users() { | |
$select_options = array(); | |
// get the list of users | |
$users = get_users(); | |
foreach ( $users as $user ) { | |
$select_options[ $user->ID ] = $user->user_nicename; | |
} | |
return $select_options; | |
} | |
\FLBuilder::register_settings_form('toolbox_starter_user_info_settings', array( | |
'title' => __('Settings', 'textdomain'), | |
'tabs' => array( | |
'general' => array( | |
'title' => __('General', 'textdomain'), | |
'sections' => array( | |
'general' => array( | |
'title' => 'General', | |
'fields' => array( | |
'starter_user' => array( | |
'type' => 'select', | |
'label' => __( 'Display User', 'textdomain' ), | |
'default' => get_current_user_id(), | |
'options' => starter_return_users(), | |
'multi-select' => false, | |
), | |
) | |
), | |
) | |
) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment