Edit File by line
/home/barbar84/www/wp-admin
File: my-sites.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* My Sites dashboard.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Multisite
[5] Fix | Delete
* @since 3.0.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
[10] Fix | Delete
if ( ! is_multisite() ) {
[11] Fix | Delete
wp_die( __( 'Multisite support is not enabled.' ) );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
if ( ! current_user_can( 'read' ) ) {
[15] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to access this page.' ) );
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
[19] Fix | Delete
[20] Fix | Delete
$blogs = get_blogs_of_user( $current_user->ID );
[21] Fix | Delete
[22] Fix | Delete
$updated = false;
[23] Fix | Delete
if ( 'updateblogsettings' === $action && isset( $_POST['primary_blog'] ) ) {
[24] Fix | Delete
check_admin_referer( 'update-my-sites' );
[25] Fix | Delete
[26] Fix | Delete
$blog = get_site( (int) $_POST['primary_blog'] );
[27] Fix | Delete
if ( $blog && isset( $blog->domain ) ) {
[28] Fix | Delete
update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true );
[29] Fix | Delete
$updated = true;
[30] Fix | Delete
} else {
[31] Fix | Delete
wp_die( __( 'The primary site you chose does not exist.' ) );
[32] Fix | Delete
}
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
$title = __( 'My Sites' );
[36] Fix | Delete
$parent_file = 'index.php';
[37] Fix | Delete
[38] Fix | Delete
get_current_screen()->add_help_tab(
[39] Fix | Delete
array(
[40] Fix | Delete
'id' => 'overview',
[41] Fix | Delete
'title' => __( 'Overview' ),
[42] Fix | Delete
'content' =>
[43] Fix | Delete
'<p>' . __( 'This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the front end or the dashboard for that site.' ) . '</p>',
[44] Fix | Delete
)
[45] Fix | Delete
);
[46] Fix | Delete
[47] Fix | Delete
get_current_screen()->set_help_sidebar(
[48] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[49] Fix | Delete
'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_My_Sites_Screen">Documentation on My Sites</a>' ) . '</p>' .
[50] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[51] Fix | Delete
);
[52] Fix | Delete
[53] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[54] Fix | Delete
[55] Fix | Delete
if ( $updated ) { ?>
[56] Fix | Delete
<div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
[57] Fix | Delete
<?php } ?>
[58] Fix | Delete
[59] Fix | Delete
<div class="wrap">
[60] Fix | Delete
<h1 class="wp-heading-inline">
[61] Fix | Delete
<?php
[62] Fix | Delete
echo esc_html( $title );
[63] Fix | Delete
?>
[64] Fix | Delete
</h1>
[65] Fix | Delete
[66] Fix | Delete
<?php
[67] Fix | Delete
if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ), true ) ) {
[68] Fix | Delete
/** This filter is documented in wp-login.php */
[69] Fix | Delete
$sign_up_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
[70] Fix | Delete
printf( ' <a href="%s" class="page-title-action">%s</a>', esc_url( $sign_up_url ), esc_html_x( 'Add New', 'site' ) );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
if ( empty( $blogs ) ) :
[74] Fix | Delete
echo '<p>';
[75] Fix | Delete
_e( 'You must be a member of at least one site to use this page.' );
[76] Fix | Delete
echo '</p>';
[77] Fix | Delete
else :
[78] Fix | Delete
?>
[79] Fix | Delete
[80] Fix | Delete
<hr class="wp-header-end">
[81] Fix | Delete
[82] Fix | Delete
<form id="myblogs" method="post">
[83] Fix | Delete
<?php
[84] Fix | Delete
choose_primary_blog();
[85] Fix | Delete
/**
[86] Fix | Delete
* Fires before the sites list on the My Sites screen.
[87] Fix | Delete
*
[88] Fix | Delete
* @since 3.0.0
[89] Fix | Delete
*/
[90] Fix | Delete
do_action( 'myblogs_allblogs_options' );
[91] Fix | Delete
?>
[92] Fix | Delete
<br clear="all" />
[93] Fix | Delete
<ul class="my-sites striped">
[94] Fix | Delete
<?php
[95] Fix | Delete
/**
[96] Fix | Delete
* Enable the Global Settings section on the My Sites screen.
[97] Fix | Delete
*
[98] Fix | Delete
* By default, the Global Settings section is hidden. Passing a non-empty
[99] Fix | Delete
* string to this filter will enable the section, and allow new settings
[100] Fix | Delete
* to be added, either globally or for specific sites.
[101] Fix | Delete
*
[102] Fix | Delete
* @since MU (3.0.0)
[103] Fix | Delete
*
[104] Fix | Delete
* @param string $settings_html The settings HTML markup. Default empty.
[105] Fix | Delete
* @param string $context Context of the setting (global or site-specific). Default 'global'.
[106] Fix | Delete
*/
[107] Fix | Delete
$settings_html = apply_filters( 'myblogs_options', '', 'global' );
[108] Fix | Delete
[109] Fix | Delete
if ( $settings_html ) {
[110] Fix | Delete
echo '<h3>' . __( 'Global Settings' ) . '</h3>';
[111] Fix | Delete
echo $settings_html;
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
reset( $blogs );
[115] Fix | Delete
[116] Fix | Delete
foreach ( $blogs as $user_blog ) {
[117] Fix | Delete
switch_to_blog( $user_blog->userblog_id );
[118] Fix | Delete
[119] Fix | Delete
echo '<li>';
[120] Fix | Delete
echo "<h3>{$user_blog->blogname}</h3>";
[121] Fix | Delete
[122] Fix | Delete
$actions = "<a href='" . esc_url( home_url() ) . "'>" . __( 'Visit' ) . '</a>';
[123] Fix | Delete
[124] Fix | Delete
if ( current_user_can( 'read' ) ) {
[125] Fix | Delete
$actions .= " | <a href='" . esc_url( admin_url() ) . "'>" . __( 'Dashboard' ) . '</a>';
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
/**
[129] Fix | Delete
* Filters the row links displayed for each site on the My Sites screen.
[130] Fix | Delete
*
[131] Fix | Delete
* @since MU (3.0.0)
[132] Fix | Delete
*
[133] Fix | Delete
* @param string $actions The HTML site link markup.
[134] Fix | Delete
* @param object $user_blog An object containing the site data.
[135] Fix | Delete
*/
[136] Fix | Delete
$actions = apply_filters( 'myblogs_blog_actions', $actions, $user_blog );
[137] Fix | Delete
[138] Fix | Delete
echo "<p class='my-sites-actions'>" . $actions . '</p>';
[139] Fix | Delete
[140] Fix | Delete
/** This filter is documented in wp-admin/my-sites.php */
[141] Fix | Delete
echo apply_filters( 'myblogs_options', '', $user_blog );
[142] Fix | Delete
[143] Fix | Delete
echo '</li>';
[144] Fix | Delete
[145] Fix | Delete
restore_current_blog();
[146] Fix | Delete
}
[147] Fix | Delete
?>
[148] Fix | Delete
</ul>
[149] Fix | Delete
<?php
[150] Fix | Delete
if ( count( $blogs ) > 1 || has_action( 'myblogs_allblogs_options' ) || has_filter( 'myblogs_options' ) ) {
[151] Fix | Delete
?>
[152] Fix | Delete
<input type="hidden" name="action" value="updateblogsettings" />
[153] Fix | Delete
<?php
[154] Fix | Delete
wp_nonce_field( 'update-my-sites' );
[155] Fix | Delete
submit_button();
[156] Fix | Delete
}
[157] Fix | Delete
?>
[158] Fix | Delete
</form>
[159] Fix | Delete
<?php endif; ?>
[160] Fix | Delete
</div>
[161] Fix | Delete
<?php
[162] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[163] Fix | Delete
[164] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function