Upload file page-login.php via GUI
This commit is contained in:
@@ -9,76 +9,145 @@ get_header(); ?>
|
||||
<div id="primary" class="content-area">
|
||||
<main id="main" class="site-main">
|
||||
<div class="custom-auth-container">
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<!-- Wenn der Benutzer angemeldet ist, zeige eine Nachricht und einen Logout-Link -->
|
||||
|
||||
<?php if ( is_user_logged_in() ) : ?>
|
||||
|
||||
<!-- Eingeloggt -->
|
||||
<div class="logged-in-message">
|
||||
<h2>Willkommen zurück, <?php echo esc_html(wp_get_current_user()->display_name); ?>!</h2>
|
||||
<p>Du bist bereits angemeldet.</p>
|
||||
<h2><?php printf( __('Willkommen zurück, %s!', 'minecraft-modern-theme'), esc_html( wp_get_current_user()->display_name ) ); ?></h2>
|
||||
<p><?php _e('Du bist bereits angemeldet.', 'minecraft-modern-theme'); ?></p>
|
||||
<p>
|
||||
<a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="button">Abmelden</a>
|
||||
<a href="<?php echo esc_url(admin_url()); ?>" class="button">Zum Dashboard</a>
|
||||
<a href="<?php echo esc_url( wp_logout_url( home_url() ) ); ?>" class="button">
|
||||
<i class="fas fa-sign-out-alt"></i> <?php _e('Abmelden', 'minecraft-modern-theme'); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url() ); ?>" class="button">
|
||||
<i class="fas fa-tachometer-alt"></i> <?php _e('Zum Dashboard', 'minecraft-modern-theme'); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<!-- Wenn der Benutzer nicht angemeldet ist, zeige das Registrierungsformular -->
|
||||
<h1 class="auth-title">Willkommen auf <?php bloginfo('name'); ?></h1>
|
||||
<p class="auth-subtitle">Erstelle deinen Account und werde Teil unserer Community!</p>
|
||||
|
||||
|
||||
<?php elseif ( get_option('users_can_register') ) : ?>
|
||||
|
||||
<!-- Registrierung erlaubt -->
|
||||
<h1 class="auth-title"><?php printf( __('Willkommen auf %s', 'minecraft-modern-theme'), get_bloginfo('name') ); ?></h1>
|
||||
<p class="auth-subtitle"><?php _e('Erstelle deinen Account und werde Teil unserer Community!', 'minecraft-modern-theme'); ?></p>
|
||||
|
||||
<?php
|
||||
// Zeige das Registrierungsformular an
|
||||
$args = array(
|
||||
'echo' => true,
|
||||
'redirect' => home_url('/login/?checkemail=registered'), // Weiterleitung nach der Registrierung
|
||||
// Fehlermeldungen aus der Query-String (z.B. nach gescheiterter Registrierung)
|
||||
if ( isset($_GET['registration']) && $_GET['registration'] === 'disabled' ) : ?>
|
||||
<div class="auth-notice auth-notice-error">
|
||||
<i class="fas fa-exclamation-circle"></i>
|
||||
<?php _e('Die Registrierung ist zurzeit deaktiviert.', 'minecraft-modern-theme'); ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
if ( isset($_GET['checkemail']) && $_GET['checkemail'] === 'registered' ) : ?>
|
||||
<div class="auth-notice auth-notice-success">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
<?php _e('Registrierung erfolgreich! Prüfe deine E-Mails für das Passwort.', 'minecraft-modern-theme'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
wp_register_form( array(
|
||||
'redirect' => home_url('/login/?checkemail=registered'),
|
||||
'form_id' => 'custom_registerform',
|
||||
'label_username' => __( 'Benutzername' ),
|
||||
'label_email' => __( 'E-Mail-Adresse' ),
|
||||
'label_password' => __( 'Passwort' ),
|
||||
'label_remember' => __( 'Angemeldet bleiben' ),
|
||||
'label_log_in' => __( 'Registrieren' ),
|
||||
'label_username' => __('Benutzername', 'minecraft-modern-theme'),
|
||||
'label_email' => __('E-Mail-Adresse', 'minecraft-modern-theme'),
|
||||
'label_password' => __('Passwort', 'minecraft-modern-theme'),
|
||||
'label_log_in' => __('Registrieren', 'minecraft-modern-theme'),
|
||||
'id_username' => 'user_login',
|
||||
'id_email' => 'user_email',
|
||||
'id_password' => 'user_pass',
|
||||
'id_remember' => 'rememberme',
|
||||
'id_submit' => 'wp-submit',
|
||||
'remember' => true,
|
||||
'value_username' => NULL,
|
||||
'value_remember' => false
|
||||
);
|
||||
wp_register_form($args);
|
||||
'value_username' => isset($_GET['user_login']) ? sanitize_user( $_GET['user_login'] ) : '',
|
||||
) );
|
||||
?>
|
||||
|
||||
|
||||
<div class="login-form-link">
|
||||
<p>Schon hast du einen Account? <a href="<?php echo esc_url(wp_login_url()); ?>">Hier anmelden</a>.</p>
|
||||
<p><?php _e('Schon einen Account?', 'minecraft-modern-theme'); ?>
|
||||
<a href="<?php echo esc_url( wp_login_url() ); ?>">
|
||||
<?php _e('Hier anmelden', 'minecraft-modern-theme'); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<!-- FIX: Registrierung deaktiviert – saubere Fehlermeldung statt kaputter Formulare -->
|
||||
<div class="auth-registration-closed">
|
||||
<div class="auth-icon"><i class="fas fa-lock fa-3x"></i></div>
|
||||
<h2><?php _e('Registrierung geschlossen', 'minecraft-modern-theme'); ?></h2>
|
||||
<p><?php _e('Neue Registrierungen sind derzeit nicht möglich. Bitte schau später wieder vorbei oder kontaktiere einen Administrator.', 'minecraft-modern-theme'); ?></p>
|
||||
<a href="<?php echo esc_url( wp_login_url() ); ?>" class="button">
|
||||
<i class="fas fa-sign-in-alt"></i> <?php _e('Zum Login', 'minecraft-modern-theme'); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Hintergrundbild aus dem Customizer holen und als Inline-CSS ausgeben
|
||||
$auth_bg_image = get_theme_mod('login_background_image');
|
||||
if ($auth_bg_image):
|
||||
?>
|
||||
$auth_bg_image = get_theme_mod('login_background_image');
|
||||
if ( $auth_bg_image ) : ?>
|
||||
<style>
|
||||
body.login, body.login-action-register {
|
||||
body {
|
||||
background-image: url('<?php echo esc_url($auth_bg_image); ?>') !important;
|
||||
background-size: cover !important;
|
||||
background-position: center !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
body.login::before, body.login-action-register::before {
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
inset: 0;
|
||||
background: rgba(20, 21, 26, 0.8);
|
||||
z-index: -1;
|
||||
}
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
/* Benachrichtigungen */
|
||||
.auth-notice {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 14px 18px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.auth-notice-success {
|
||||
background: rgba(0, 212, 100, 0.12);
|
||||
border-left: 4px solid #00d464;
|
||||
color: #00d464;
|
||||
}
|
||||
.auth-notice-error {
|
||||
background: rgba(255, 60, 60, 0.1);
|
||||
border-left: 4px solid #ff3c3c;
|
||||
color: #ff3c3c;
|
||||
}
|
||||
|
||||
/* Registrierung geschlossen */
|
||||
.auth-registration-closed {
|
||||
text-align: center;
|
||||
padding: 60px 40px;
|
||||
background: var(--card-bg);
|
||||
border-radius: 10px;
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.auth-icon {
|
||||
color: var(--primary-accent, #00d4ff);
|
||||
margin-bottom: 20px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.auth-registration-closed h2 { margin-bottom: 12px; }
|
||||
.auth-registration-closed p { color: var(--text-muted, #a0a0a0); margin-bottom: 24px; }
|
||||
</style>
|
||||
|
||||
<?php get_footer(); ?>
|
||||
Reference in New Issue
Block a user