feat: match Anbieter Login form styles to Mentor Login and show company name on Jobangebot
Anbieter Login (/anbieter-login/): - Add auth-forms.css with styles matching the Mentor Login reference (navy pill buttons, bold #333 labels at 18px, consistent input sizing) - Enqueue CSS only on the login page via stored page ID - Strip legacy inline styles from page content via the_content filter - Inject "Passwort vergessen?" link after login form - Pixel-perfect field alignment between registration and login columns (matching Formidable's 97px field spacing, label padding, and margins) - Override Formidable's flex-row submit wrapper for full-width button Jobangebot (single job_offer): - Display company name next to provider logo in a flex .job-header container - Graceful fallback when logo or org name is missing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,58 @@ class DDHH_JM_Pages {
|
||||
public static function setup_hooks() {
|
||||
// Redirect logged-in providers from login page to dashboard
|
||||
add_action( 'template_redirect', array( __CLASS__, 'maybe_redirect_logged_in_from_login' ) );
|
||||
|
||||
// Enqueue auth form styles on anbieter-login page
|
||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_auth_styles' ) );
|
||||
|
||||
// Clean up legacy inline styles and inject missing elements on login page
|
||||
add_filter( 'the_content', array( __CLASS__, 'filter_login_page_content' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue auth form styles on the anbieter-login page
|
||||
*/
|
||||
public static function enqueue_auth_styles() {
|
||||
$login_page_id = get_option( 'ddhh_jm_login_page_id' );
|
||||
if ( ! $login_page_id || ! is_page( $login_page_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style(
|
||||
'ddhh-jm-auth-forms',
|
||||
DDHH_JM_PLUGIN_URL . 'assets/css/auth-forms.css',
|
||||
array(),
|
||||
DDHH_JM_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter login page content to remove legacy inline styles and inject missing elements
|
||||
*
|
||||
* @param string $content Page content.
|
||||
* @return string Filtered content.
|
||||
*/
|
||||
public static function filter_login_page_content( $content ) {
|
||||
$login_page_id = get_option( 'ddhh_jm_login_page_id' );
|
||||
if ( ! $login_page_id || ! is_page( $login_page_id ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
// Strip legacy inline <style> blocks baked into the page content
|
||||
$content = preg_replace( '/<style[^>]*>.*?<\/style>/s', '', $content );
|
||||
|
||||
// Inject "Passwort vergessen?" link after the login form if not already present
|
||||
if ( strpos( $content, 'login-lost-password' ) === false ) {
|
||||
$lost_pw_html = '<p class="login-lost-password"><a href="' . esc_url( wp_lostpassword_url() ) . '">Passwort vergessen?</a></p>';
|
||||
|
||||
// Insert after the closing </form> inside the login section
|
||||
$pos = strrpos( $content, '</form>' );
|
||||
if ( false !== $pos ) {
|
||||
$content = substr_replace( $content, '</form>' . $lost_pw_html, $pos, strlen( '</form>' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,66 +161,8 @@ class DDHH_JM_Pages {
|
||||
// Get registration form ID
|
||||
$registration_form_id = DDHH_JM_Formidable::get_registration_form_id();
|
||||
|
||||
// Build page content with inline CSS and two sections
|
||||
$content = '<style>
|
||||
.ddhh-auth-container {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
margin: 2rem 0;
|
||||
}
|
||||
|
||||
.ddhh-register-section,
|
||||
.ddhh-login-section {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
background: #f9f9f9;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.ddhh-register-section h2,
|
||||
.ddhh-login-section h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #333;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
/* Mobile responsive - stacked layout */
|
||||
@media (max-width: 768px) {
|
||||
.ddhh-auth-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
/* Form styling for consistency */
|
||||
.ddhh-auth-container input[type="text"],
|
||||
.ddhh-auth-container input[type="email"],
|
||||
.ddhh-auth-container input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ddhh-auth-container input[type="submit"],
|
||||
.ddhh-auth-container button[type="submit"] {
|
||||
background: #0073aa;
|
||||
color: white;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.ddhh-auth-container input[type="submit"]:hover,
|
||||
.ddhh-auth-container button[type="submit"]:hover {
|
||||
background: #005a87;
|
||||
}
|
||||
</style>';
|
||||
// Build page content — styles are loaded via enqueued auth-forms.css
|
||||
$content = '';
|
||||
|
||||
$content .= '<div class="ddhh-auth-container">';
|
||||
|
||||
@@ -197,6 +191,7 @@ class DDHH_JM_Pages {
|
||||
);
|
||||
|
||||
$content .= wp_login_form( $login_args );
|
||||
$content .= '<p class="login-lost-password"><a href="' . esc_url( wp_lostpassword_url() ) . '">Passwort vergessen?</a></p>';
|
||||
$content .= '</div>';
|
||||
|
||||
$content .= '</div>'; // .ddhh-auth-container
|
||||
|
||||
Reference in New Issue
Block a user