Edit File by line
/home/zeestwma/ceyloniy...
File: wp-signup.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Signup Page
[2] Fix | Delete
*
[3] Fix | Delete
* Handles the user registration and site creation process for multisite installations.
[4] Fix | Delete
*
[5] Fix | Delete
* @package WordPress
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/** Sets up the WordPress Environment. */
[9] Fix | Delete
require __DIR__ . '/wp-load.php';
[10] Fix | Delete
[11] Fix | Delete
add_filter( 'wp_robots', 'wp_robots_no_robots' );
[12] Fix | Delete
[13] Fix | Delete
require __DIR__ . '/wp-blog-header.php';
[14] Fix | Delete
[15] Fix | Delete
nocache_headers();
[16] Fix | Delete
[17] Fix | Delete
if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ), true ) ) {
[18] Fix | Delete
wp_redirect( network_home_url() );
[19] Fix | Delete
die();
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Prints signup_header via wp_head.
[24] Fix | Delete
*
[25] Fix | Delete
* @since MU (3.0.0)
[26] Fix | Delete
*/
[27] Fix | Delete
function do_signup_header() {
[28] Fix | Delete
/**
[29] Fix | Delete
* Fires within the head section of the site sign-up screen.
[30] Fix | Delete
*
[31] Fix | Delete
* @since 3.0.0
[32] Fix | Delete
*/
[33] Fix | Delete
do_action( 'signup_header' );
[34] Fix | Delete
}
[35] Fix | Delete
add_action( 'wp_head', 'do_signup_header' );
[36] Fix | Delete
[37] Fix | Delete
if ( ! is_multisite() ) {
[38] Fix | Delete
wp_redirect( wp_registration_url() );
[39] Fix | Delete
die();
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
if ( ! is_main_site() ) {
[43] Fix | Delete
wp_redirect( network_site_url( 'wp-signup.php' ) );
[44] Fix | Delete
die();
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
// Fix for page title.
[48] Fix | Delete
$wp_query->is_404 = false;
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Fires before the Site Sign-up page is loaded.
[52] Fix | Delete
*
[53] Fix | Delete
* @since 4.4.0
[54] Fix | Delete
*/
[55] Fix | Delete
do_action( 'before_signup_header' );
[56] Fix | Delete
[57] Fix | Delete
/**
[58] Fix | Delete
* Prints styles for front-end Multisite Sign-up pages.
[59] Fix | Delete
*
[60] Fix | Delete
* @since MU (3.0.0)
[61] Fix | Delete
*/
[62] Fix | Delete
function wpmu_signup_stylesheet() {
[63] Fix | Delete
?>
[64] Fix | Delete
<style type="text/css">
[65] Fix | Delete
.mu_register { width: 90%; margin: 0 auto; }
[66] Fix | Delete
.mu_register form { margin-top: 2em; }
[67] Fix | Delete
.mu_register fieldset,
[68] Fix | Delete
.mu_register legend { margin: 0; padding: 0; border: none; }
[69] Fix | Delete
.mu_register .error { padding: 10px; color: #333; background: #ffebe8; border: 1px solid #c00; }
[70] Fix | Delete
.mu_register input[type="submit"],
[71] Fix | Delete
.mu_register #blog_title,
[72] Fix | Delete
.mu_register #user_email,
[73] Fix | Delete
.mu_register #blogname,
[74] Fix | Delete
.mu_register #user_name { width: 100%; font-size: 24px; margin: 5px 0; box-sizing: border-box; }
[75] Fix | Delete
.mu_register #site-language { display: block; }
[76] Fix | Delete
.mu_register .prefix_address,
[77] Fix | Delete
.mu_register .suffix_address { font-size: 18px; display: inline-block; direction: ltr; }
[78] Fix | Delete
.mu_register label,
[79] Fix | Delete
.mu_register legend,
[80] Fix | Delete
.mu_register .label-heading { font-weight: 600; font-size: 15px; display: block; margin: 10px 0; }
[81] Fix | Delete
.mu_register legend + p,
[82] Fix | Delete
.mu_register input + p { margin-top: 0; }
[83] Fix | Delete
.mu_register label.checkbox { display: inline; }
[84] Fix | Delete
.mu_register .mu_alert { font-weight: 600; padding: 10px; color: #333; background: #ffffe0; border: 1px solid #e6db55; }
[85] Fix | Delete
.mu_register .mu_alert a { color: inherit; text-decoration: underline; }
[86] Fix | Delete
.mu_register .signup-options .wp-signup-radio-button { display: block; }
[87] Fix | Delete
.mu_register .privacy-intro .wp-signup-radio-button { margin-right: 0.5em; }
[88] Fix | Delete
.rtl .mu_register .wp-signup-blogname { direction: ltr; text-align: right; }
[89] Fix | Delete
</style>
[90] Fix | Delete
<?php
[91] Fix | Delete
}
[92] Fix | Delete
add_action( 'wp_head', 'wpmu_signup_stylesheet' );
[93] Fix | Delete
[94] Fix | Delete
get_header( 'wp-signup' );
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* Fires before the site Sign-up form.
[98] Fix | Delete
*
[99] Fix | Delete
* @since 3.0.0
[100] Fix | Delete
*/
[101] Fix | Delete
do_action( 'before_signup_form' );
[102] Fix | Delete
?>
[103] Fix | Delete
<div id="signup-content" class="widecolumn">
[104] Fix | Delete
<div class="mu_register wp-signup-container" role="main">
[105] Fix | Delete
<?php
[106] Fix | Delete
/**
[107] Fix | Delete
* Generates and displays the Sign-up and Create Site forms.
[108] Fix | Delete
*
[109] Fix | Delete
* @since MU (3.0.0)
[110] Fix | Delete
*
[111] Fix | Delete
* @param string $blogname The new site name.
[112] Fix | Delete
* @param string $blog_title The new site title.
[113] Fix | Delete
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
[114] Fix | Delete
*/
[115] Fix | Delete
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
[116] Fix | Delete
if ( ! is_wp_error( $errors ) ) {
[117] Fix | Delete
$errors = new WP_Error();
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
$current_network = get_network();
[121] Fix | Delete
// Site name.
[122] Fix | Delete
if ( ! is_subdomain_install() ) {
[123] Fix | Delete
echo '<label for="blogname">' . __( 'Site Name (subdirectory only):' ) . '</label>';
[124] Fix | Delete
} else {
[125] Fix | Delete
echo '<label for="blogname">' . __( 'Site Domain (subdomain only):' ) . '</label>';
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
$errmsg_blogname = $errors->get_error_message( 'blogname' );
[129] Fix | Delete
$errmsg_blogname_aria = '';
[130] Fix | Delete
if ( $errmsg_blogname ) {
[131] Fix | Delete
$errmsg_blogname_aria = 'wp-signup-blogname-error ';
[132] Fix | Delete
echo '<p class="error" id="wp-signup-blogname-error">' . $errmsg_blogname . '</p>';
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
if ( ! is_subdomain_install() ) {
[136] Fix | Delete
echo '<div class="wp-signup-blogname"><span class="prefix_address" id="prefix-address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'prefix-address" /></div>';
[137] Fix | Delete
} else {
[138] Fix | Delete
$site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
[139] Fix | Delete
echo '<div class="wp-signup-blogname"><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'suffix-address" /><span class="suffix_address" id="suffix-address">.' . esc_html( $site_domain ) . '</span></div>';
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
if ( ! is_user_logged_in() ) {
[143] Fix | Delete
if ( ! is_subdomain_install() ) {
[144] Fix | Delete
$site = $current_network->domain . $current_network->path . __( 'sitename' );
[145] Fix | Delete
} else {
[146] Fix | Delete
$site = __( 'domain' ) . '.' . $site_domain . $current_network->path;
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
printf(
[150] Fix | Delete
'<p>(<strong>%s</strong>) %s</p>',
[151] Fix | Delete
/* translators: %s: Site address. */
[152] Fix | Delete
sprintf( __( 'Your address will be %s.' ), $site ),
[153] Fix | Delete
__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' )
[154] Fix | Delete
);
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
// Site Title.
[158] Fix | Delete
?>
[159] Fix | Delete
<label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
[160] Fix | Delete
<?php
[161] Fix | Delete
$errmsg_blog_title = $errors->get_error_message( 'blog_title' );
[162] Fix | Delete
$errmsg_blog_title_aria = '';
[163] Fix | Delete
if ( $errmsg_blog_title ) {
[164] Fix | Delete
$errmsg_blog_title_aria = ' aria-describedby="wp-signup-blog-title-error"';
[165] Fix | Delete
echo '<p class="error" id="wp-signup-blog-title-error">' . $errmsg_blog_title . '</p>';
[166] Fix | Delete
}
[167] Fix | Delete
echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" required="required" autocomplete="off"' . $errmsg_blog_title_aria . ' />';
[168] Fix | Delete
?>
[169] Fix | Delete
[170] Fix | Delete
<?php
[171] Fix | Delete
// Site Language.
[172] Fix | Delete
$languages = signup_get_available_languages();
[173] Fix | Delete
[174] Fix | Delete
if ( ! empty( $languages ) ) :
[175] Fix | Delete
?>
[176] Fix | Delete
<p>
[177] Fix | Delete
<label for="site-language"><?php _e( 'Site Language:' ); ?></label>
[178] Fix | Delete
<?php
[179] Fix | Delete
// Network default.
[180] Fix | Delete
$lang = get_site_option( 'WPLANG' );
[181] Fix | Delete
[182] Fix | Delete
if ( isset( $_POST['WPLANG'] ) ) {
[183] Fix | Delete
$lang = $_POST['WPLANG'];
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
// Use US English if the default isn't available.
[187] Fix | Delete
if ( ! in_array( $lang, $languages, true ) ) {
[188] Fix | Delete
$lang = '';
[189] Fix | Delete
}
[190] Fix | Delete
[191] Fix | Delete
wp_dropdown_languages(
[192] Fix | Delete
array(
[193] Fix | Delete
'name' => 'WPLANG',
[194] Fix | Delete
'id' => 'site-language',
[195] Fix | Delete
'selected' => $lang,
[196] Fix | Delete
'languages' => $languages,
[197] Fix | Delete
'show_available_translations' => false,
[198] Fix | Delete
)
[199] Fix | Delete
);
[200] Fix | Delete
?>
[201] Fix | Delete
</p>
[202] Fix | Delete
<?php
[203] Fix | Delete
endif; // Languages.
[204] Fix | Delete
[205] Fix | Delete
$blog_public_on_checked = '';
[206] Fix | Delete
$blog_public_off_checked = '';
[207] Fix | Delete
if ( isset( $_POST['blog_public'] ) && '0' === $_POST['blog_public'] ) {
[208] Fix | Delete
$blog_public_off_checked = 'checked="checked"';
[209] Fix | Delete
} else {
[210] Fix | Delete
$blog_public_on_checked = 'checked="checked"';
[211] Fix | Delete
}
[212] Fix | Delete
?>
[213] Fix | Delete
[214] Fix | Delete
<div id="privacy">
[215] Fix | Delete
<fieldset class="privacy-intro">
[216] Fix | Delete
<legend>
[217] Fix | Delete
<span class="label-heading"><?php _e( 'Privacy:' ); ?></span>
[218] Fix | Delete
<?php _e( 'Allow search engines to index this site.' ); ?>
[219] Fix | Delete
</legend>
[220] Fix | Delete
<p class="wp-signup-radio-buttons">
[221] Fix | Delete
<span class="wp-signup-radio-button">
[222] Fix | Delete
<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> />
[223] Fix | Delete
<label class="checkbox" for="blog_public_on"><?php _e( 'Yes' ); ?></label>
[224] Fix | Delete
</span>
[225] Fix | Delete
<span class="wp-signup-radio-button">
[226] Fix | Delete
<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php echo $blog_public_off_checked; ?> />
[227] Fix | Delete
<label class="checkbox" for="blog_public_off"><?php _e( 'No' ); ?></label>
[228] Fix | Delete
</span>
[229] Fix | Delete
</p>
[230] Fix | Delete
</fieldset>
[231] Fix | Delete
</div>
[232] Fix | Delete
[233] Fix | Delete
<?php
[234] Fix | Delete
/**
[235] Fix | Delete
* Fires after the site sign-up form.
[236] Fix | Delete
*
[237] Fix | Delete
* @since 3.0.0
[238] Fix | Delete
*
[239] Fix | Delete
* @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
[240] Fix | Delete
*/
[241] Fix | Delete
do_action( 'signup_blogform', $errors );
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
/**
[245] Fix | Delete
* Validates the new site sign-up.
[246] Fix | Delete
*
[247] Fix | Delete
* @since MU (3.0.0)
[248] Fix | Delete
*
[249] Fix | Delete
* @return array Contains the new site data and error messages.
[250] Fix | Delete
* See wpmu_validate_blog_signup() for details.
[251] Fix | Delete
*/
[252] Fix | Delete
function validate_blog_form() {
[253] Fix | Delete
$user = '';
[254] Fix | Delete
if ( is_user_logged_in() ) {
[255] Fix | Delete
$user = wp_get_current_user();
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
return wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'], $user );
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
/**
[262] Fix | Delete
* Displays the fields for the new user account registration form.
[263] Fix | Delete
*
[264] Fix | Delete
* @since MU (3.0.0)
[265] Fix | Delete
*
[266] Fix | Delete
* @param string $user_name The entered username.
[267] Fix | Delete
* @param string $user_email The entered email address.
[268] Fix | Delete
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
[269] Fix | Delete
*/
[270] Fix | Delete
function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
[271] Fix | Delete
if ( ! is_wp_error( $errors ) ) {
[272] Fix | Delete
$errors = new WP_Error();
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
// Username.
[276] Fix | Delete
echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
[277] Fix | Delete
$errmsg_username = $errors->get_error_message( 'user_name' );
[278] Fix | Delete
$errmsg_username_aria = '';
[279] Fix | Delete
if ( $errmsg_username ) {
[280] Fix | Delete
$errmsg_username_aria = 'wp-signup-username-error ';
[281] Fix | Delete
echo '<p class="error" id="wp-signup-username-error">' . $errmsg_username . '</p>';
[282] Fix | Delete
}
[283] Fix | Delete
?>
[284] Fix | Delete
<input name="user_name" type="text" id="user_name" value="<?php echo esc_attr( $user_name ); ?>" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" required="required" aria-describedby="<?php echo $errmsg_username_aria; ?>wp-signup-username-description" />
[285] Fix | Delete
<p id="wp-signup-username-description"><?php _e( '(Must be at least 4 characters, lowercase letters and numbers only.)' ); ?></p>
[286] Fix | Delete
[287] Fix | Delete
<?php
[288] Fix | Delete
// Email address.
[289] Fix | Delete
echo '<label for="user_email">' . __( 'Email&nbsp;Address:' ) . '</label>';
[290] Fix | Delete
$errmsg_email = $errors->get_error_message( 'user_email' );
[291] Fix | Delete
$errmsg_email_aria = '';
[292] Fix | Delete
if ( $errmsg_email ) {
[293] Fix | Delete
$errmsg_email_aria = 'wp-signup-email-error ';
[294] Fix | Delete
echo '<p class="error" id="wp-signup-email-error">' . $errmsg_email . '</p>';
[295] Fix | Delete
}
[296] Fix | Delete
?>
[297] Fix | Delete
<input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" autocomplete="email" required="required" aria-describedby="<?php echo $errmsg_email_aria; ?>wp-signup-email-description" />
[298] Fix | Delete
<p id="wp-signup-email-description"><?php _e( 'Your registration email is sent to this address. (Double-check your email address before continuing.)' ); ?></p>
[299] Fix | Delete
[300] Fix | Delete
<?php
[301] Fix | Delete
// Extra fields.
[302] Fix | Delete
$errmsg_generic = $errors->get_error_message( 'generic' );
[303] Fix | Delete
if ( $errmsg_generic ) {
[304] Fix | Delete
echo '<p class="error" id="wp-signup-generic-error">' . $errmsg_generic . '</p>';
[305] Fix | Delete
}
[306] Fix | Delete
/**
[307] Fix | Delete
* Fires at the end of the new user account registration form.
[308] Fix | Delete
*
[309] Fix | Delete
* @since 3.0.0
[310] Fix | Delete
*
[311] Fix | Delete
* @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
[312] Fix | Delete
*/
[313] Fix | Delete
do_action( 'signup_extra_fields', $errors );
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
/**
[317] Fix | Delete
* Validates user sign-up name and email.
[318] Fix | Delete
*
[319] Fix | Delete
* @since MU (3.0.0)
[320] Fix | Delete
*
[321] Fix | Delete
* @return array Contains username, email, and error messages.
[322] Fix | Delete
* See wpmu_validate_user_signup() for details.
[323] Fix | Delete
*/
[324] Fix | Delete
function validate_user_form() {
[325] Fix | Delete
return wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
/**
[329] Fix | Delete
* Shows a form for returning users to sign up for another site.
[330] Fix | Delete
*
[331] Fix | Delete
* @since MU (3.0.0)
[332] Fix | Delete
*
[333] Fix | Delete
* @param string $blogname The new site name
[334] Fix | Delete
* @param string $blog_title The new site title.
[335] Fix | Delete
* @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
[336] Fix | Delete
*/
[337] Fix | Delete
function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
[338] Fix | Delete
$current_user = wp_get_current_user();
[339] Fix | Delete
[340] Fix | Delete
if ( ! is_wp_error( $errors ) ) {
[341] Fix | Delete
$errors = new WP_Error();
[342] Fix | Delete
}
[343] Fix | Delete
[344] Fix | Delete
$signup_defaults = array(
[345] Fix | Delete
'blogname' => $blogname,
[346] Fix | Delete
'blog_title' => $blog_title,
[347] Fix | Delete
'errors' => $errors,
[348] Fix | Delete
);
[349] Fix | Delete
[350] Fix | Delete
/**
[351] Fix | Delete
* Filters the default site sign-up variables.
[352] Fix | Delete
*
[353] Fix | Delete
* @since 3.0.0
[354] Fix | Delete
*
[355] Fix | Delete
* @param array $signup_defaults {
[356] Fix | Delete
* An array of default site sign-up variables.
[357] Fix | Delete
*
[358] Fix | Delete
* @type string $blogname The site blogname.
[359] Fix | Delete
* @type string $blog_title The site title.
[360] Fix | Delete
* @type WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
[361] Fix | Delete
* }
[362] Fix | Delete
*/
[363] Fix | Delete
$filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
[364] Fix | Delete
[365] Fix | Delete
$blogname = $filtered_results['blogname'];
[366] Fix | Delete
$blog_title = $filtered_results['blog_title'];
[367] Fix | Delete
$errors = $filtered_results['errors'];
[368] Fix | Delete
[369] Fix | Delete
/* translators: %s: Network title. */
[370] Fix | Delete
echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
[371] Fix | Delete
[372] Fix | Delete
if ( $errors->has_errors() ) {
[373] Fix | Delete
echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
[374] Fix | Delete
}
[375] Fix | Delete
?>
[376] Fix | Delete
<p>
[377] Fix | Delete
<?php
[378] Fix | Delete
printf(
[379] Fix | Delete
/* translators: %s: Current user's display name. */
[380] Fix | Delete
__( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ),
[381] Fix | Delete
$current_user->display_name
[382] Fix | Delete
);
[383] Fix | Delete
?>
[384] Fix | Delete
</p>
[385] Fix | Delete
[386] Fix | Delete
<?php
[387] Fix | Delete
$blogs = get_blogs_of_user( $current_user->ID );
[388] Fix | Delete
if ( ! empty( $blogs ) ) {
[389] Fix | Delete
?>
[390] Fix | Delete
[391] Fix | Delete
<p><?php _e( 'Sites you are already a member of:' ); ?></p>
[392] Fix | Delete
<ul>
[393] Fix | Delete
<?php
[394] Fix | Delete
foreach ( $blogs as $blog ) {
[395] Fix | Delete
$home_url = get_home_url( $blog->userblog_id );
[396] Fix | Delete
echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
[397] Fix | Delete
}
[398] Fix | Delete
?>
[399] Fix | Delete
</ul>
[400] Fix | Delete
<?php } ?>
[401] Fix | Delete
[402] Fix | Delete
<p><?php _e( 'If you are not going to use a great site domain, leave it for a new user. Now have at it!' ); ?></p>
[403] Fix | Delete
<form id="setupform" method="post" action="wp-signup.php">
[404] Fix | Delete
<input type="hidden" name="stage" value="gimmeanotherblog" />
[405] Fix | Delete
<?php
[406] Fix | Delete
/**
[407] Fix | Delete
* Fires when hidden sign-up form fields output when creating another site or user.
[408] Fix | Delete
*
[409] Fix | Delete
* @since MU (3.0.0)
[410] Fix | Delete
*
[411] Fix | Delete
* @param string $context A string describing the steps of the sign-up process. The value can be
[412] Fix | Delete
* 'create-another-site', 'validate-user', or 'validate-site'.
[413] Fix | Delete
*/
[414] Fix | Delete
do_action( 'signup_hidden_fields', 'create-another-site' );
[415] Fix | Delete
?>
[416] Fix | Delete
<?php show_blog_form( $blogname, $blog_title, $errors ); ?>
[417] Fix | Delete
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ); ?>" /></p>
[418] Fix | Delete
</form>
[419] Fix | Delete
<?php
[420] Fix | Delete
}
[421] Fix | Delete
[422] Fix | Delete
/**
[423] Fix | Delete
* Validates a new site sign-up for an existing user.
[424] Fix | Delete
*
[425] Fix | Delete
* @since MU (3.0.0)
[426] Fix | Delete
*
[427] Fix | Delete
* @global string $blogname The new site's subdomain or directory name.
[428] Fix | Delete
* @global string $blog_title The new site's title.
[429] Fix | Delete
* @global WP_Error $errors Existing errors in the global scope.
[430] Fix | Delete
* @global string $domain The new site's domain.
[431] Fix | Delete
* @global string $path The new site's path.
[432] Fix | Delete
*
[433] Fix | Delete
* @return null|bool True if site signup was validated, false on error.
[434] Fix | Delete
* The function halts all execution if the user is not logged in.
[435] Fix | Delete
*/
[436] Fix | Delete
function validate_another_blog_signup() {
[437] Fix | Delete
global $blogname, $blog_title, $errors, $domain, $path;
[438] Fix | Delete
$current_user = wp_get_current_user();
[439] Fix | Delete
if ( ! is_user_logged_in() ) {
[440] Fix | Delete
die();
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
$result = validate_blog_form();
[444] Fix | Delete
[445] Fix | Delete
// Extracted values set/overwrite globals.
[446] Fix | Delete
$domain = $result['domain'];
[447] Fix | Delete
$path = $result['path'];
[448] Fix | Delete
$blogname = $result['blogname'];
[449] Fix | Delete
$blog_title = $result['blog_title'];
[450] Fix | Delete
$errors = $result['errors'];
[451] Fix | Delete
[452] Fix | Delete
if ( $errors->has_errors() ) {
[453] Fix | Delete
signup_another_blog( $blogname, $blog_title, $errors );
[454] Fix | Delete
return false;
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
$public = (int) $_POST['blog_public'];
[458] Fix | Delete
[459] Fix | Delete
$blog_meta_defaults = array(
[460] Fix | Delete
'lang_id' => 1,
[461] Fix | Delete
'public' => $public,
[462] Fix | Delete
);
[463] Fix | Delete
[464] Fix | Delete
// Handle the language setting for the new site.
[465] Fix | Delete
if ( ! empty( $_POST['WPLANG'] ) ) {
[466] Fix | Delete
[467] Fix | Delete
$languages = signup_get_available_languages();
[468] Fix | Delete
[469] Fix | Delete
if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
[470] Fix | Delete
$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
[471] Fix | Delete
[472] Fix | Delete
if ( $language ) {
[473] Fix | Delete
$blog_meta_defaults['WPLANG'] = $language;
[474] Fix | Delete
}
[475] Fix | Delete
}
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
/**
[479] Fix | Delete
* Filters the new site meta variables.
[480] Fix | Delete
*
[481] Fix | Delete
* Use the {@see 'add_signup_meta'} filter instead.
[482] Fix | Delete
*
[483] Fix | Delete
* @since MU (3.0.0)
[484] Fix | Delete
* @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead.
[485] Fix | Delete
*
[486] Fix | Delete
* @param array $blog_meta_defaults An array of default blog meta variables.
[487] Fix | Delete
*/
[488] Fix | Delete
$meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );
[489] Fix | Delete
[490] Fix | Delete
/**
[491] Fix | Delete
* Filters the new default site meta variables.
[492] Fix | Delete
*
[493] Fix | Delete
* @since 3.0.0
[494] Fix | Delete
*
[495] Fix | Delete
* @param array $meta {
[496] Fix | Delete
* An array of default site meta variables.
[497] Fix | Delete
*
[498] Fix | Delete
* @type int $lang_id The language ID.
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function