Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save badabingbreda/0afc7663718419a636bc27483f2e29ba to your computer and use it in GitHub Desktop.
Save badabingbreda/0afc7663718419a636bc27483f2e29ba to your computer and use it in GitHub Desktop.
Toolbox Docs: Plugin Development Alias Module Settings Form
<?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