Even more multi-site registration crap

Seriously!
This commit is contained in:
Tetrakern 2024-05-16 20:35:05 +02:00
parent 5b911b250a
commit f55425610c
9 changed files with 41 additions and 33 deletions

View File

@ -107,7 +107,7 @@ Fires between the sites `<main>` and `<footer>` blocks. This is the empty spa
* $breadcrumbs (array) Array of breadcrumb tuples with label (0) and link (1).
**Hooked Actions:**
* `fictioneer_wp_signup_end( $args )` End of the wrapper HTML for the wp-signup page. Priority 999.
* `fictioneer_mu_registration_end( $args )` End of the wrapper HTML for wp-signup/wp-activate. Priority 999.
---
@ -594,7 +594,7 @@ Fires outside the `#site` container and before the `wp_footer` hook, near the en
**Hooked Actions:**
* `fictioneer_output_modals( $args )` Render modals based on login status and page type. Priority 10.
* `fictioneer_wp_signup_start( $args )` Start of the wrapper HTML for the wp-signup page. Priority 999.
* `fictioneer_mu_registration_start( $args )` Start of the wrapper HTML for wp-signup/wp-activate. Priority 999.
---

View File

@ -248,7 +248,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
| `wp_dashboard_setup` | `fictioneer_remove_dashboard_widgets`
| `wp_default_scripts` | `fictioneer_remove_jquery_migrate`
| `wp_enqueue_scripts` | `fictioneer_add_custom_scripts`, `fictioneer_customizer_queue`, `fictioneer_style_queue`
| `wp_head` | `fictioneer_output_head_seo`, `fictioneer_output_rss`, `fictioneer_output_schemas`, `fictioneer_add_fiction_css`, `fictioneer_output_head_fonts`, `fictioneer_output_head_translations`, `fictioneer_remove_wp_signup_style`, `fictioneer_output_signup_style`
| `wp_head` | `fictioneer_output_head_seo`, `fictioneer_output_rss`, `fictioneer_output_schemas`, `fictioneer_add_fiction_css`, `fictioneer_output_head_fonts`, `fictioneer_output_head_translations`, `fictioneer_remove_mu_registration_styles`, `fictioneer_output_mu_registration_style`
| `wp_update_nav_menu` | `fictioneer_purge_nav_menu_transients`
<br>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -48,8 +48,12 @@ if ( ! defined( 'CHILD_NAME' ) ) {
* Locations
*/
if ( ! defined( 'FICTIONEER_IS_WP_SIGNUP' ) ) {
define( 'FICTIONEER_IS_WP_SIGNUP', strpos( $_SERVER['REQUEST_URI'], 'wp-signup.php' ) !== false );
if ( ! defined( 'FICTIONEER_MU_REGISTRATION' ) ) {
define(
'FICTIONEER_MU_REGISTRATION',
strpos( $_SERVER['REQUEST_URI'], 'wp-signup.php' ) !== false ||
strpos( $_SERVER['REQUEST_URI'], 'wp-activate.php' ) !== false
);
}
/*

View File

@ -36,7 +36,7 @@ if ( $page_id != $post_id ) {
$post_id = $page_id;
}
if ( is_archive() || is_search() || is_404() ) {
if ( is_archive() || is_search() || is_404() || FICTIONEER_MU_REGISTRATION ) {
$post_id = null;
}
@ -52,7 +52,7 @@ if ( is_archive() || is_search() || is_404() ) {
fictioneer_output_head_meta();
// Prevent indexing if required
if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_IS_WP_SIGNUP ) {
if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_MU_REGISTRATION ) {
add_filter( 'wp_robots', 'fictioneer_add_noindex_to_robots' );
}

View File

@ -1574,46 +1574,50 @@ function fictioneer_redirect_story() {
add_action( 'template_redirect', 'fictioneer_redirect_story' );
// =============================================================================
// WP-SIGNUP STYLE
// WP-SIGNUP AND WP-ACTIVATE
// =============================================================================
/**
* Remove default style of wp-signup.php
* Remove default styles of wp-signup.php and wp-activate.php
*
* @since 5.18.1
*/
function fictioneer_remove_wp_signup_style() {
function fictioneer_remove_mu_registration_styles() {
remove_action( 'wp_head', 'wpmu_signup_stylesheet' );
remove_action( 'wp_head', 'wpmu_activate_stylesheet' );
}
/**
* Output styles for wo-signup.php
* Output styles for wp-signup.php and wp-activate.php
*
* @since 5.18.1
*/
function fictioneer_output_signup_style() {
function fictioneer_output_mu_registration_style() {
// Start HTML ---> ?>
<style type="text/css">
.wp-signup-container label[for] {
:is(.wp-signup-container, .wp-activate-container) label[for] {
display: block;
color: var(--fg-500);
font-size: var(--fs-xs);
font-weight: var(--font-weight-medium);
padding: 0 0 2px;
}
.wp-signup-container :where(input[type="text"], input[type="email"], input[type="password"], input[type="tel"]) {
:is(.wp-signup-container, .wp-activate-container) :where(input[type="text"], input[type="email"], input[type="password"], input[type="tel"]) {
display: block;
width: 100%;
}
.wp-signup-container p[id*="-description"] {
:is(.wp-signup-container, .wp-activate-container) p {
margin-bottom: 1.5rem;
}
:is(.wp-signup-container, .wp-activate-container) p[id*="-description"] {
color: var(--fg-900);
font-size: var(--fs-xxs);
line-height: 1.3;
padding: .5rem 2px 0;
}
.wp-signup-container p[id*="-error"] {
:is(.wp-signup-container, .wp-activate-container) p[id*="-error"] {
display: flex;
align-items: flex-start;
gap: .5rem;
@ -1631,7 +1635,7 @@ function fictioneer_output_signup_style() {
<?php // <--- End HTML
}
if ( FICTIONEER_IS_WP_SIGNUP ) {
add_action( 'wp_head', 'fictioneer_remove_wp_signup_style', 1 );
add_action( 'wp_head', 'fictioneer_output_signup_style' );
if ( FICTIONEER_MU_REGISTRATION ) {
add_action( 'wp_head', 'fictioneer_remove_mu_registration_styles', 1 );
add_action( 'wp_head', 'fictioneer_output_mu_registration_style' );
}

View File

@ -873,11 +873,11 @@ if ( get_option( 'fictioneer_show_wp_login_link' ) ) {
}
// =============================================================================
// OUTPUT WP-SIGNUP "PAGE"
// OUTPUT WP-SIGNUP AND WP-ACTIVE "PAGE"
// =============================================================================
/**
* Outputs the start of the page wrapper HTML for wp-signup on multi-sites
* Outputs the start of the page wrapper HTML for the wp-signup.php and wp-activate.php
*
* @since 5.18.1
*
@ -887,32 +887,32 @@ if ( get_option( 'fictioneer_show_wp_login_link' ) ) {
* @param array $args['header_args'] Arguments passed to the header.php partial.
*/
function fictioneer_wp_signup_start( $args ) {
function fictioneer_mu_registration_start( $args ) {
// Start HTML ---> ?>
<main id="main" class="main singular wp-signup">
<main id="main" class="main singular wp-registration">
<div class="observer main-observer"></div>
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>
<article id="singular-wp-signup" class="singular__article padding-left padding-right padding-top padding-bottom">
<article id="singular-wp-registration" class="singular__article padding-left padding-right padding-top padding-bottom">
<section class="singular__content content-section">
<?php // <--- End HTML
}
if ( FICTIONEER_IS_WP_SIGNUP ) {
add_action( 'fictioneer_site', 'fictioneer_wp_signup_start', 999 );
if ( FICTIONEER_MU_REGISTRATION ) {
add_action( 'fictioneer_site', 'fictioneer_mu_registration_start', 999 );
}
/**
* Outputs the end of the page wrapper HTML for wp-signup on multi-sites
* Outputs the end of the page wrapper HTML for the wp-signup.php and wp-activate.php
*
* @since 5.18.1
*
* @param int|null $args['post_id'] Optional. Current post ID.
*/
function fictioneer_wp_signup_end( $args ) {
function fictioneer_mu_registration_end( $args ) {
// Start HTML ---> ?>
</section>
<footer class="singular__footer"><?php do_action( 'fictioneer_singular_footer' ); ?></footer>
@ -922,6 +922,6 @@ function fictioneer_wp_signup_end( $args ) {
<?php // <--- End HTML
}
if ( FICTIONEER_IS_WP_SIGNUP ) {
add_action( 'fictioneer_after_main', 'fictioneer_wp_signup_end', 999 );
if ( FICTIONEER_MU_REGISTRATION ) {
add_action( 'fictioneer_after_main', 'fictioneer_mu_registration_end', 999 );
}

View File

@ -154,7 +154,7 @@
.post-password-form input[type=submit],
button[type=submit]:where(:not(._inline)),
.wp-signup-container input[type=submit] {
:where(.wp-signup-container, .wp-activate-container) input[type=submit] {
@extend %button;
}