: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'st' => 'Sotho, Southern',
'es' => 'Spanish; Castilian',
'to' => 'Tonga (Tonga Islands)',
'ug' => 'Uighur; Uyghur',
'za' => 'Zhuang; Chuang',
* Filters the language codes.
* @param string[] $lang_codes Array of key/value pairs of language codes where key is the short version.
* @param string $code A two-letter designation of the language.
$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
return strtr( $code, $lang_codes );
* Displays an access denied message when a user tries to view a site's dashboard they
function _access_denied_splash() {
if ( ! is_user_logged_in() || is_network_admin() ) {
$blogs = get_blogs_of_user( get_current_user_id() );
if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
$blog_name = get_bloginfo( 'name' );
/* translators: 1: Site title. */
__( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ),
$output = '<p>' . sprintf(
/* translators: 1: Site title. */
__( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ),
$output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
$output .= '<h3>' . __( 'Your Sites' ) . '</h3>';
foreach ( $blogs as $blog ) {
$output .= "<td>{$blog->blogname}</td>";
$output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
'<a href="' . esc_url( get_home_url( $blog->userblog_id ) ) . '">' . __( 'View Site' ) . '</a></td>';
* Checks if the current user has permissions to import new users.
* @param string $permission A permission to be checked. Currently not used.
* @return bool True if the user has proper permissions, false if they do not.
function check_import_new_users( $permission ) {
if ( ! current_user_can( 'manage_network_users' ) ) {
// See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too.
* Generates and displays a drop-down of available languages.
* @param string[] $lang_files Optional. An array of the language files. Default empty array.
* @param string $current Optional. The current language code. Default empty.
function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
foreach ( (array) $lang_files as $val ) {
$code_lang = basename( $val, '.mo' );
if ( 'en_US' === $code_lang ) { // American English.
$ae = __( 'American English' );
$output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
} elseif ( 'en_GB' === $code_lang ) { // British English.
$be = __( 'British English' );
$output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
$translated = format_code_lang( $code_lang );
$output[ $translated ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html( $translated ) . '</option>';
if ( false === $flag ) { // WordPress English.
$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>';
uksort( $output, 'strnatcasecmp' );
* Filters the languages available in the dropdown.
* @param string[] $output Array of HTML output for the dropdown.
* @param string[] $lang_files Array of available language files.
* @param string $current The current language code.
$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
echo implode( "\n\t", $output );
* Displays an admin notice to upgrade all sites after a core upgrade.
* @global int $wp_db_version WordPress database version.
* @global string $pagenow The filename of the current screen.
* @return void|false Void on success. False if the current user is not a super admin.
function site_admin_notice() {
global $wp_db_version, $pagenow;
if ( ! current_user_can( 'upgrade_network' ) ) {
if ( 'upgrade.php' === $pagenow ) {
if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) {
$upgrade_network_message = sprintf(
/* translators: %s: URL to Upgrade Network screen. */
__( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ),
esc_url( network_admin_url( 'upgrade.php' ) )
$upgrade_network_message,
'additional_classes' => array( 'update-nag', 'inline' ),
'paragraph_wrap' => false,
* Avoids a collision between a site slug and a permalink slug.
* In a subdirectory installation this will make sure that a site and a post do not use the
* same subdirectory by checking for a site with the same name as a new post.
* @param array $data An array of post data.
* @param array $postarr An array of posts. Not currently used.
* @return array The new array of post data after checking for collisions.
function avoid_blog_page_permalink_collision( $data, $postarr ) {
if ( is_subdomain_install() ) {
if ( 'page' !== $data['post_type'] ) {
if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) {
if ( ! is_main_site() ) {
if ( isset( $data['post_parent'] ) && $data['post_parent'] ) {
$post_name = $data['post_name'];
while ( $c < 10 && get_id_from_blogname( $post_name ) ) {
$post_name .= mt_rand( 1, 10 );
if ( $post_name !== $data['post_name'] ) {
$data['post_name'] = $post_name;
* Handles the display of choosing a user's primary site.
* This displays the user's primary site and allows the user to choose
function choose_primary_blog() {
<table class="form-table" role="presentation">
<?php /* translators: My Sites label. */ ?>
<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
$all_blogs = get_blogs_of_user( get_current_user_id() );
$primary_blog = (int) get_user_meta( get_current_user_id(), 'primary_blog', true );
if ( count( $all_blogs ) > 1 ) {
<select name="primary_blog" id="primary_blog">
foreach ( (array) $all_blogs as $blog ) {
if ( $blog->userblog_id === $primary_blog ) {
<option value="<?php echo $blog->userblog_id; ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ); ?></option>
$blog = reset( $all_blogs );
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
} elseif ( 1 === count( $all_blogs ) ) {
$blog = reset( $all_blogs );
echo esc_url( get_home_url( $blog->userblog_id ) );
if ( $blog->userblog_id !== $primary_blog ) { // Set the primary blog again if it's out of sync with blog list.
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
* Determines whether or not this network from this page can be edited.
* By default editing of network is restricted to the Network Admin for that `$network_id`.
* This function allows for this to be overridden.
* @param int $network_id The network ID to check.
* @return bool True if network can be edited, false otherwise.
function can_edit_network( $network_id ) {
if ( get_current_network_id() === (int) $network_id ) {
* Filters whether this network can be edited from this page.
* @param bool $result Whether the network can be edited from this page.
* @param int $network_id The network ID to check.
return apply_filters( 'can_edit_network', $result, $network_id );
* Prints thickbox image paths for Network Admin.
function _thickbox_path_admin_subfolder() {
<script type="text/javascript">
var tb_pathToImage = "<?php echo esc_js( includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ) ); ?>";
function confirm_delete_users( $users ) {
$current_user = wp_get_current_user();
if ( ! is_array( $users ) || empty( $users ) ) {
<h1><?php esc_html_e( 'Users' ); ?></h1>
<?php if ( 1 === count( $users ) ) : ?>
<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
<form action="users.php?action=dodelete" method="post">
<input type="hidden" name="dodelete" />
wp_nonce_field( 'ms-users-delete' );
$site_admins = get_super_admins();
$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>';
<table class="form-table" role="presentation">
$allusers = (array) $_POST['allusers'];
foreach ( $allusers as $user_id ) {
if ( '' !== $user_id && '0' !== $user_id ) {
$delete_user = get_userdata( $user_id );
if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
/* translators: %s: User login. */
__( 'Warning! User %s cannot be deleted.' ),
if ( in_array( $delete_user->user_login, $site_admins, true ) ) {
/* translators: %s: User login. */
__( 'Warning! User cannot be deleted. The user %s is a network administrator.' ),
'<em>' . $delete_user->user_login . '</em>'
<th scope="row"><?php echo $delete_user->user_login; ?>
<?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
$blogs = get_blogs_of_user( $user_id, true );
if ( ! empty( $blogs ) ) {
<td><fieldset><p><legend>
/* translators: %s: User login. */
__( 'What should be done with content owned by %s?' ),
'<em>' . $delete_user->user_login . '</em>'
foreach ( (array) $blogs as $key => $details ) {
'blog_id' => $details->userblog_id,
'fields' => array( 'ID', 'user_login' ),
if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
$user_dropdown = '<label for="reassign_user" class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
$user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
foreach ( $blog_users as $user ) {
if ( ! in_array( (int) $user->ID, $allusers, true ) ) {
$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
if ( '' === $user_list ) {
$user_dropdown .= $user_list;
$user_dropdown .= "</select>\n";
<ul style="list-style:none;">
/* translators: %s: Link to user's site. */
printf( __( 'Site: %s' ), $user_site );
<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="delete" checked="checked" />
<?php _e( 'Delete all content.' ); ?></label></li>
<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="reassign" />
<?php _e( 'Attribute all content to:' ); ?></label>
<?php echo $user_dropdown; ?></li>
echo '</fieldset></td></tr>';
<td><p><?php _e( 'User has no sites or content and will be deleted.' ); ?></p></td>
/** This action is documented in wp-admin/users.php */
do_action( 'delete_user_form', $current_user, $allusers );
if ( 1 === count( $users ) ) :
<p><?php _e( 'Once you hit “Confirm Deletion”, the user will be permanently removed.' ); ?></p>
<p><?php _e( 'Once you hit “Confirm Deletion”, these users will be permanently removed.' ); ?></p>
submit_button( __( 'Confirm Deletion' ), 'primary' );