Files
David Stone d88e50df38 Prep Plugin for release on WordPress.org (#23)
* Update translation text domain
* Escape everything that should be escaped.
* Add nonce checks where needed.
* Sanitize all inputs.
* Apply Code style changes across the codebase.
* Correct many deprecation notices.
* Optimize load order of many filters.
* Add Proper Build script
* Use emojii flags
* Fix i18n deprecation  notice for translating too early
* Put all scripts in footer and load async
2025-04-14 11:36:46 -06:00

39 lines
788 B
PHP

<?php
/**
* User Helper Functions
*
* @package WP_Ultimo\Functions
* @since 2.0.0
*/
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Returns a list of valid selectable roles.
*
* @since 2.0.0
* @param boolean $add_default_option Adds a new default option.
* @return array
*/
function wu_get_roles_as_options($add_default_option = false) {
if ( ! function_exists('get_editable_roles')) {
require_once ABSPATH . 'wp-admin/includes/user.php';
}
$roles = [];
if ($add_default_option) {
$roles['default'] = __('Use WP Multisite WaaS default', 'wp-multisite-waas');
}
$editable_roles = get_editable_roles();
foreach ($editable_roles as $role => $details) {
$roles[ esc_attr($role) ] = translate_user_role($details['name']);
}
return $roles;
}