Compare commits
8 Commits
290c4e427f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 148cd7c5c6 | |||
| 7d14914b02 | |||
| c21d7000ef | |||
| b7c6bb79e7 | |||
| 346ef5097b | |||
| f0de02ca94 | |||
| 0bef634eb8 | |||
| f8ec35e72f |
165
assets/css/auth-forms.css
Normal file
165
assets/css/auth-forms.css
Normal file
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* Auth Forms Styles — Anbieter Login Page
|
||||
*
|
||||
* Matches the Mentor:innen Login styles from general.css.
|
||||
* Loaded only on the anbieter-login page to override baked-in inline CSS.
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
/* -----------------------------------------------
|
||||
Layout: two-column container
|
||||
----------------------------------------------- */
|
||||
.ddhh-auth-container {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
margin: 2rem 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.ddhh-auth-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
Sections: remove gray card backgrounds
|
||||
----------------------------------------------- */
|
||||
.ddhh-register-section,
|
||||
.ddhh-login-section {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.ddhh-register-section h2,
|
||||
.ddhh-login-section h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5rem;
|
||||
color: #333;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
Labels: match Mentor Login (color #333, 18px, bold)
|
||||
High specificity to override Formidable's
|
||||
.with_frm_style .frm_primary_label selectors
|
||||
----------------------------------------------- */
|
||||
.ddhh-auth-container label,
|
||||
.ddhh-auth-container .frm_forms.with_frm_style .frm_primary_label {
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
line-height: 18px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
Inputs: match Mentor Login field sizing
|
||||
----------------------------------------------- */
|
||||
.ddhh-auth-container input[type="text"],
|
||||
.ddhh-auth-container input[type="email"],
|
||||
.ddhh-auth-container input[type="password"],
|
||||
.ddhh-auth-container input[type="url"],
|
||||
.ddhh-auth-container input[type="tel"],
|
||||
.ddhh-auth-container select {
|
||||
width: 100%;
|
||||
min-height: 40px;
|
||||
max-width: 350px;
|
||||
border: 0.0625rem solid;
|
||||
border-radius: 3px;
|
||||
padding: 0.1875rem 0.3125rem;
|
||||
margin: 0 6px 16px 0;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
line-height: normal;
|
||||
font-family: "Poppins", Sans, Helvetica, Arial;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
Formidable submit wrapper: override flex-row
|
||||
so the button stretches to full width
|
||||
----------------------------------------------- */
|
||||
.ddhh-auth-container .frm_submit.frm_flex {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
Buttons: navy pill with red hover
|
||||
High specificity to override Formidable's
|
||||
.frm_style_formidable-style.with_frm_style selectors
|
||||
----------------------------------------------- */
|
||||
.ddhh-auth-container input[type="submit"],
|
||||
.ddhh-auth-container button[type="submit"],
|
||||
.ddhh-auth-container .frm_forms.with_frm_style .frm_submit button.frm_button_submit {
|
||||
background-color: var(--wp--preset--color--primary, #003063);
|
||||
border-width: 0;
|
||||
color: #fff;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
padding: 0.4em 1.333em;
|
||||
border-radius: 100px;
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
max-width: 350px;
|
||||
cursor: pointer;
|
||||
transition: all 0.7s ease;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ddhh-auth-container input[type="submit"]:hover,
|
||||
.ddhh-auth-container button[type="submit"]:hover,
|
||||
.ddhh-auth-container .frm_forms.with_frm_style .frm_submit button.frm_button_submit:hover {
|
||||
background-color: var(--wp--preset--color--hhred, #E40613);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
wp_login_form() specific: style the <p> wrappers
|
||||
----------------------------------------------- */
|
||||
.ddhh-login-section .login-username,
|
||||
.ddhh-login-section .login-password {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ddhh-login-section .login-remember,
|
||||
.ddhh-login-section .login-submit {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.ddhh-login-section .login-username br,
|
||||
.ddhh-login-section .login-password br {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ddhh-login-section .login-username label,
|
||||
.ddhh-login-section .login-password label {
|
||||
display: block;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
.ddhh-login-section .login-remember label {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------
|
||||
Passwort vergessen link
|
||||
----------------------------------------------- */
|
||||
.ddhh-login-section .login-lost-password {
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.ddhh-login-section .login-lost-password a {
|
||||
color: var(--wp--preset--color--primary, #003063);
|
||||
text-decoration: underline;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.ddhh-login-section .login-lost-password a:hover {
|
||||
color: var(--wp--preset--color--hhred, #E40613);
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Digital Dabei Job Manager
|
||||
* Plugin URI: https://www.hamburg.de/digital-dabei
|
||||
* Plugin URI: https://hamburg-digital-dabei.de
|
||||
* Description: Closed job board for provider self-registration and mentor applications
|
||||
* Version: 1.0.0
|
||||
* Author: digital dabei Hamburg
|
||||
* Author URI: https://www.hamburg.de/digital-dabei
|
||||
* Author: vihais
|
||||
* Author URI: https://hamburg-digital-dabei.de
|
||||
* Text Domain: ddhh-job-manager
|
||||
* Domain Path: /languages
|
||||
* Requires at least: 6.0
|
||||
@@ -45,8 +45,13 @@ require_once DDHH_JM_PLUGIN_DIR . 'includes/class-template.php';
|
||||
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-admin-ui.php';
|
||||
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-user-preferences.php';
|
||||
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-scheduler.php';
|
||||
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-elementor-tags.php';
|
||||
require_once DDHH_JM_PLUGIN_DIR . 'includes/class-ddhh-job-manager.php';
|
||||
|
||||
// Register activation and deactivation hooks (must be at top level).
|
||||
register_activation_hook( __FILE__, array( 'DDHH_JM_Activator', 'activate' ) );
|
||||
register_deactivation_hook( __FILE__, array( 'DDHH_JM_Deactivator', 'deactivate' ) );
|
||||
|
||||
/**
|
||||
* Initialize the plugin.
|
||||
*/
|
||||
@@ -54,3 +59,11 @@ function ddhh_jm_init() {
|
||||
DDHH_JM_Job_Manager::get_instance();
|
||||
}
|
||||
add_action( 'plugins_loaded', 'ddhh_jm_init', 10 );
|
||||
|
||||
/**
|
||||
* Initialize Elementor dynamic tags when Elementor is loaded.
|
||||
*/
|
||||
function ddhh_jm_elementor_init() {
|
||||
DDHH_JM_Elementor_Tags::init();
|
||||
}
|
||||
add_action( 'elementor/init', 'ddhh_jm_elementor_init' );
|
||||
|
||||
@@ -68,17 +68,6 @@ class DDHH_JM_ACF_Fields {
|
||||
'type' => 'email',
|
||||
'required' => 1,
|
||||
),
|
||||
// Job Logo
|
||||
array(
|
||||
'key' => 'field_job_logo',
|
||||
'label' => __( 'Logo', 'ddhh-job-manager' ),
|
||||
'name' => 'job_logo',
|
||||
'type' => 'image',
|
||||
'required' => 0,
|
||||
'return_format' => 'id',
|
||||
'preview_size' => 'thumbnail',
|
||||
'library' => 'all',
|
||||
),
|
||||
// Job Deactivation Reason (internal, admin-only)
|
||||
array(
|
||||
'key' => 'field_job_deactivation_reason',
|
||||
|
||||
@@ -43,10 +43,6 @@ class DDHH_JM_Job_Manager {
|
||||
* Initialize hooks
|
||||
*/
|
||||
private function init_hooks() {
|
||||
// Register activation and deactivation hooks
|
||||
register_activation_hook( DDHH_JM_PLUGIN_FILE, array( 'DDHH_JM_Activator', 'activate' ) );
|
||||
register_deactivation_hook( DDHH_JM_PLUGIN_FILE, array( 'DDHH_JM_Deactivator', 'deactivate' ) );
|
||||
|
||||
// Initialize post types
|
||||
add_action( 'init', array( 'DDHH_JM_Post_Types', 'register' ) );
|
||||
|
||||
|
||||
58
includes/class-elementor-tags.php
Normal file
58
includes/class-elementor-tags.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor Dynamic Tags integration.
|
||||
*
|
||||
* Registers custom dynamic tags for job offer fields so they appear
|
||||
* in the Elementor editor's dynamic tags dropdown under a
|
||||
* "Stellenangebot" group.
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Class DDHH_JM_Elementor_Tags
|
||||
*/
|
||||
class DDHH_JM_Elementor_Tags {
|
||||
|
||||
/**
|
||||
* Group slug used for all job offer tags.
|
||||
*/
|
||||
const GROUP_SLUG = 'ddhh-job-offer';
|
||||
|
||||
/**
|
||||
* Initialize hooks.
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'elementor/dynamic_tags/register', array( __CLASS__, 'register_tags' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the dynamic tag group and individual tags.
|
||||
*
|
||||
* @param \Elementor\Core\DynamicTags\Manager $manager Elementor dynamic tags manager.
|
||||
*/
|
||||
public static function register_tags( $manager ) {
|
||||
$manager->register_group(
|
||||
self::GROUP_SLUG,
|
||||
array(
|
||||
'title' => 'Stellenangebot',
|
||||
)
|
||||
);
|
||||
|
||||
$tag_dir = DDHH_JM_PLUGIN_DIR . 'includes/elementor-tags/';
|
||||
|
||||
require_once $tag_dir . 'class-tag-job-location.php';
|
||||
require_once $tag_dir . 'class-tag-job-type.php';
|
||||
require_once $tag_dir . 'class-tag-job-deadline.php';
|
||||
require_once $tag_dir . 'class-tag-job-contact-email.php';
|
||||
require_once $tag_dir . 'class-tag-job-logo.php';
|
||||
|
||||
$manager->register( new DDHH_JM_Tag_Job_Location() );
|
||||
$manager->register( new DDHH_JM_Tag_Job_Type() );
|
||||
$manager->register( new DDHH_JM_Tag_Job_Deadline() );
|
||||
$manager->register( new DDHH_JM_Tag_Job_Contact_Email() );
|
||||
$manager->register( new DDHH_JM_Tag_Job_Logo() );
|
||||
}
|
||||
}
|
||||
@@ -156,6 +156,7 @@ class DDHH_JM_Formidable {
|
||||
add_action( 'init', array( __CLASS__, 'create_registration_form' ), 11 );
|
||||
add_action( 'init', array( __CLASS__, 'create_job_submission_form' ), 11 );
|
||||
add_action( 'init', array( __CLASS__, 'create_job_edit_form' ), 11 );
|
||||
add_action( 'init', array( __CLASS__, 'repair_job_form_fields' ), 12 );
|
||||
add_action( 'init', array( __CLASS__, 'create_job_deactivation_form' ), 11 );
|
||||
add_action( 'init', array( __CLASS__, 'create_job_application_form' ), 11 );
|
||||
|
||||
@@ -808,19 +809,13 @@ class DDHH_JM_Formidable {
|
||||
'field_order' => 3,
|
||||
),
|
||||
array(
|
||||
'name' => 'Art',
|
||||
'field_key' => 'job_type',
|
||||
'type' => 'select',
|
||||
'required' => '1',
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 4,
|
||||
'field_options' => array(
|
||||
'options' => array(
|
||||
'Vollzeit' => 'Vollzeit',
|
||||
'Teilzeit' => 'Teilzeit',
|
||||
'Ehrenamt' => 'Ehrenamt',
|
||||
),
|
||||
),
|
||||
'name' => 'Art',
|
||||
'field_key' => 'job_type',
|
||||
'type' => 'select',
|
||||
'required' => '1',
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 4,
|
||||
'options' => array( '', 'Vollzeit', 'Teilzeit', 'Ehrenamt' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'Bewerbungsfrist',
|
||||
@@ -841,19 +836,6 @@ class DDHH_JM_Formidable {
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 6,
|
||||
),
|
||||
array(
|
||||
'name' => 'Logo',
|
||||
'field_key' => 'job_logo',
|
||||
'type' => 'file',
|
||||
'required' => '0',
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 7,
|
||||
'field_options' => array(
|
||||
'restrict' => '1',
|
||||
'allowed_types' => 'image/jpeg,image/png',
|
||||
'max_size' => '2',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Store field IDs for form action mapping
|
||||
@@ -867,49 +849,20 @@ class DDHH_JM_Formidable {
|
||||
|
||||
// Create the Create Post action
|
||||
if ( ! empty( $field_ids ) ) {
|
||||
$action_values = array(
|
||||
'menu_order' => 1,
|
||||
'post_status' => 'published',
|
||||
'post_content' => array(
|
||||
'post_type' => 'job_offer',
|
||||
'post_status' => 'pending',
|
||||
'post_title' => $field_ids['job_title'],
|
||||
'post_content' => $field_ids['job_description'],
|
||||
'post_author' => 'current_user',
|
||||
'post_custom_fields' => array(
|
||||
array(
|
||||
'meta_name' => 'job_location',
|
||||
'field_id' => $field_ids['job_location'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_type',
|
||||
'field_id' => $field_ids['job_type'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_deadline',
|
||||
'field_id' => $field_ids['job_deadline'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_contact_email',
|
||||
'field_id' => $field_ids['job_contact_email'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_logo',
|
||||
'field_id' => $field_ids['job_logo'],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Create the form action using the proper API
|
||||
FrmFormActionsController::create_action(
|
||||
$form_id,
|
||||
array(
|
||||
'post_excerpt' => 'wppost',
|
||||
'post_content' => $action_values,
|
||||
'menu_order' => 1,
|
||||
)
|
||||
$action_control = FrmFormActionsController::get_form_actions( 'wppost' );
|
||||
$new_action = $action_control->prepare_new( $form_id );
|
||||
$new_action->post_content['post_type'] = 'job_offer';
|
||||
$new_action->post_content['post_status'] = 'pending';
|
||||
$new_action->post_content['post_title'] = $field_ids['job_title'];
|
||||
$new_action->post_content['post_content'] = $field_ids['job_description'];
|
||||
$new_action->post_content['post_author'] = 'current_user';
|
||||
$new_action->post_content['post_custom_fields'] = array(
|
||||
array( 'meta_name' => 'job_location', 'field_id' => $field_ids['job_location'] ),
|
||||
array( 'meta_name' => 'job_type', 'field_id' => $field_ids['job_type'] ),
|
||||
array( 'meta_name' => 'job_deadline', 'field_id' => $field_ids['job_deadline'] ),
|
||||
array( 'meta_name' => 'job_contact_email', 'field_id' => $field_ids['job_contact_email'] ),
|
||||
);
|
||||
$action_control->save_settings( $new_action );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -978,19 +931,13 @@ class DDHH_JM_Formidable {
|
||||
'field_order' => 3,
|
||||
),
|
||||
array(
|
||||
'name' => 'Art',
|
||||
'field_key' => 'job_type',
|
||||
'type' => 'select',
|
||||
'required' => '1',
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 4,
|
||||
'field_options' => array(
|
||||
'options' => array(
|
||||
'Vollzeit' => 'Vollzeit',
|
||||
'Teilzeit' => 'Teilzeit',
|
||||
'Ehrenamt' => 'Ehrenamt',
|
||||
),
|
||||
),
|
||||
'name' => 'Art',
|
||||
'field_key' => 'job_type',
|
||||
'type' => 'select',
|
||||
'required' => '1',
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 4,
|
||||
'options' => array( '', 'Vollzeit', 'Teilzeit', 'Ehrenamt' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'Bewerbungsfrist',
|
||||
@@ -1011,19 +958,6 @@ class DDHH_JM_Formidable {
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 6,
|
||||
),
|
||||
array(
|
||||
'name' => 'Logo',
|
||||
'field_key' => 'job_logo',
|
||||
'type' => 'file',
|
||||
'required' => '0',
|
||||
'form_id' => $form_id,
|
||||
'field_order' => 7,
|
||||
'field_options' => array(
|
||||
'restrict' => '1',
|
||||
'allowed_types' => 'image/jpeg,image/png',
|
||||
'max_size' => '2',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Store field IDs for form action mapping
|
||||
@@ -1037,52 +971,62 @@ class DDHH_JM_Formidable {
|
||||
|
||||
// Create the Update Post action
|
||||
if ( ! empty( $field_ids ) ) {
|
||||
$action_values = array(
|
||||
'menu_order' => 1,
|
||||
'post_status' => 'published',
|
||||
'post_content' => array(
|
||||
'post_type' => 'job_offer',
|
||||
'post_status' => 'pending',
|
||||
'post_title' => $field_ids['job_title'],
|
||||
'post_content' => $field_ids['job_description'],
|
||||
'post_id' => 'id_param',
|
||||
'post_custom_fields' => array(
|
||||
array(
|
||||
'meta_name' => 'job_location',
|
||||
'field_id' => $field_ids['job_location'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_type',
|
||||
'field_id' => $field_ids['job_type'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_deadline',
|
||||
'field_id' => $field_ids['job_deadline'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_contact_email',
|
||||
'field_id' => $field_ids['job_contact_email'],
|
||||
),
|
||||
array(
|
||||
'meta_name' => 'job_logo',
|
||||
'field_id' => $field_ids['job_logo'],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Create the form action using the proper API
|
||||
FrmFormActionsController::create_action(
|
||||
$form_id,
|
||||
array(
|
||||
'post_excerpt' => 'wppost',
|
||||
'post_content' => $action_values,
|
||||
'menu_order' => 1,
|
||||
)
|
||||
$action_control = FrmFormActionsController::get_form_actions( 'wppost' );
|
||||
$new_action = $action_control->prepare_new( $form_id );
|
||||
$new_action->post_content['post_type'] = 'job_offer';
|
||||
$new_action->post_content['post_status'] = 'pending';
|
||||
$new_action->post_content['post_title'] = $field_ids['job_title'];
|
||||
$new_action->post_content['post_content'] = $field_ids['job_description'];
|
||||
$new_action->post_content['post_id'] = 'id_param';
|
||||
$new_action->post_content['post_custom_fields'] = array(
|
||||
array( 'meta_name' => 'job_location', 'field_id' => $field_ids['job_location'] ),
|
||||
array( 'meta_name' => 'job_type', 'field_id' => $field_ids['job_type'] ),
|
||||
array( 'meta_name' => 'job_deadline', 'field_id' => $field_ids['job_deadline'] ),
|
||||
array( 'meta_name' => 'job_contact_email', 'field_id' => $field_ids['job_contact_email'] ),
|
||||
);
|
||||
$action_control->save_settings( $new_action );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repair existing job form fields in the database.
|
||||
*
|
||||
* Fixes the job_type select options and removes the job_logo field
|
||||
* from both the submission and edit forms. Runs once and stores a
|
||||
* version flag in wp_options to avoid re-running.
|
||||
*/
|
||||
public static function repair_job_form_fields() {
|
||||
if ( ! class_exists( 'FrmField' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$repair_version = '1';
|
||||
if ( get_option( 'ddhh_jm_form_repair_version' ) === $repair_version ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fix job_type options on both forms.
|
||||
$correct_options = array( '', 'Vollzeit', 'Teilzeit', 'Ehrenamt' );
|
||||
foreach ( array( 'job_type', 'job_type2' ) as $key ) {
|
||||
$field = FrmField::getOne( $key );
|
||||
if ( $field ) {
|
||||
FrmField::update( $field->id, array(
|
||||
'options' => serialize( $correct_options ),
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove job_logo fields from both forms.
|
||||
foreach ( array( 'job_logo', 'job_logo2' ) as $key ) {
|
||||
$field = FrmField::getOne( $key );
|
||||
if ( $field ) {
|
||||
FrmField::destroy( $field->id );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'ddhh_jm_form_repair_version', $repair_version );
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-populate edit form fields with existing post data
|
||||
*
|
||||
@@ -1251,31 +1195,15 @@ class DDHH_JM_Formidable {
|
||||
|
||||
// Create the Update Post action
|
||||
if ( ! empty( $field_ids ) ) {
|
||||
$action_values = array(
|
||||
'menu_order' => 1,
|
||||
'post_status' => 'published',
|
||||
'post_content' => array(
|
||||
'post_type' => 'job_offer',
|
||||
'post_status' => 'draft',
|
||||
'post_id' => 'id_param',
|
||||
'post_custom_fields' => array(
|
||||
array(
|
||||
'meta_name' => 'job_deactivation_reason',
|
||||
'field_id' => $field_ids['deactivation_reason'],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Create the form action using the proper API
|
||||
FrmFormActionsController::create_action(
|
||||
$form_id,
|
||||
array(
|
||||
'post_excerpt' => 'wppost',
|
||||
'post_content' => $action_values,
|
||||
'menu_order' => 1,
|
||||
)
|
||||
$action_control = FrmFormActionsController::get_form_actions( 'wppost' );
|
||||
$new_action = $action_control->prepare_new( $form_id );
|
||||
$new_action->post_content['post_type'] = 'job_offer';
|
||||
$new_action->post_content['post_status'] = 'draft';
|
||||
$new_action->post_content['post_id'] = 'id_param';
|
||||
$new_action->post_content['post_custom_fields'] = array(
|
||||
array( 'meta_name' => 'job_deactivation_reason', 'field_id' => $field_ids['deactivation_reason'] ),
|
||||
);
|
||||
$action_control->save_settings( $new_action );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -47,6 +47,9 @@ class DDHH_JM_Template {
|
||||
$author = get_userdata( $post->post_author );
|
||||
$author_name = $author ? $author->display_name : '';
|
||||
$author_org = get_user_meta( $post->post_author, 'ddhh_org_name', true );
|
||||
if ( ! $author_org ) {
|
||||
$author_org = $author_name;
|
||||
}
|
||||
|
||||
// Build job details HTML
|
||||
ob_start();
|
||||
@@ -55,9 +58,16 @@ class DDHH_JM_Template {
|
||||
<a href="<?php echo esc_url( get_post_type_archive_link( 'job_offer' ) ); ?>">← Alle Jobangebote</a>
|
||||
</div>
|
||||
<div class="ddhh-job-offer-details">
|
||||
<?php if ( $job_logo ) : ?>
|
||||
<div class="job-logo">
|
||||
<?php echo $job_logo; ?>
|
||||
<?php if ( $job_logo || $author_org ) : ?>
|
||||
<div class="job-header">
|
||||
<?php if ( $job_logo ) : ?>
|
||||
<div class="job-logo">
|
||||
<?php echo $job_logo; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( $author_org ) : ?>
|
||||
<span class="job-header-org"><?php echo esc_html( $author_org ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -137,13 +147,20 @@ class DDHH_JM_Template {
|
||||
.ddhh-job-offer-details {
|
||||
margin: 2em 0;
|
||||
}
|
||||
.ddhh-job-offer-details .job-logo {
|
||||
.ddhh-job-offer-details .job-header {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
.ddhh-job-offer-details .job-logo img {
|
||||
max-width: 200px;
|
||||
height: auto;
|
||||
}
|
||||
.ddhh-job-offer-details .job-header-org {
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
font-size: 1.4em;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.ddhh-job-offer-details .job-meta {
|
||||
background: #f5f5f5;
|
||||
padding: 1.5em;
|
||||
|
||||
38
includes/elementor-tags/class-tag-job-contact-email.php
Normal file
38
includes/elementor-tags/class-tag-job-contact-email.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor dynamic tag: Kontakt-E-Mail (job_contact_email).
|
||||
*
|
||||
* Registered in both TEXT and URL categories so it can be used
|
||||
* as link href (mailto:) or plain text display.
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class DDHH_JM_Tag_Job_Contact_Email extends \Elementor\Core\DynamicTags\Tag {
|
||||
|
||||
public function get_name(): string {
|
||||
return 'ddhh-job-contact-email';
|
||||
}
|
||||
|
||||
public function get_title(): string {
|
||||
return 'Kontakt-E-Mail';
|
||||
}
|
||||
|
||||
public function get_group(): array {
|
||||
return array( DDHH_JM_Elementor_Tags::GROUP_SLUG );
|
||||
}
|
||||
|
||||
public function get_categories(): array {
|
||||
return array(
|
||||
\Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY,
|
||||
\Elementor\Modules\DynamicTags\Module::URL_CATEGORY,
|
||||
);
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$value = get_post_meta( get_the_ID(), 'job_contact_email', true );
|
||||
echo esc_html( $value );
|
||||
}
|
||||
}
|
||||
44
includes/elementor-tags/class-tag-job-deadline.php
Normal file
44
includes/elementor-tags/class-tag-job-deadline.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor dynamic tag: Bewerbungsfrist (job_deadline).
|
||||
*
|
||||
* Formats the stored Y-m-d date as DD.MM.YYYY for display.
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class DDHH_JM_Tag_Job_Deadline extends \Elementor\Core\DynamicTags\Tag {
|
||||
|
||||
public function get_name(): string {
|
||||
return 'ddhh-job-deadline';
|
||||
}
|
||||
|
||||
public function get_title(): string {
|
||||
return 'Bewerbungsfrist';
|
||||
}
|
||||
|
||||
public function get_group(): array {
|
||||
return array( DDHH_JM_Elementor_Tags::GROUP_SLUG );
|
||||
}
|
||||
|
||||
public function get_categories(): array {
|
||||
return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$raw = get_post_meta( get_the_ID(), 'job_deadline', true );
|
||||
if ( empty( $raw ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$timestamp = strtotime( $raw );
|
||||
if ( false === $timestamp ) {
|
||||
echo esc_html( $raw );
|
||||
return;
|
||||
}
|
||||
|
||||
echo esc_html( date_i18n( 'd.m.Y', $timestamp ) );
|
||||
}
|
||||
}
|
||||
32
includes/elementor-tags/class-tag-job-location.php
Normal file
32
includes/elementor-tags/class-tag-job-location.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor dynamic tag: Standort (job_location).
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class DDHH_JM_Tag_Job_Location extends \Elementor\Core\DynamicTags\Tag {
|
||||
|
||||
public function get_name(): string {
|
||||
return 'ddhh-job-location';
|
||||
}
|
||||
|
||||
public function get_title(): string {
|
||||
return 'Standort';
|
||||
}
|
||||
|
||||
public function get_group(): array {
|
||||
return array( DDHH_JM_Elementor_Tags::GROUP_SLUG );
|
||||
}
|
||||
|
||||
public function get_categories(): array {
|
||||
return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$value = get_post_meta( get_the_ID(), 'job_location', true );
|
||||
echo wp_kses_post( $value );
|
||||
}
|
||||
}
|
||||
68
includes/elementor-tags/class-tag-job-logo.php
Normal file
68
includes/elementor-tags/class-tag-job-logo.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor dynamic tag: Logo.
|
||||
*
|
||||
* Extends Data_Tag to return image data (id + url) for use in
|
||||
* Image widgets and other image-accepting controls.
|
||||
*
|
||||
* The logo is stored on the provider (post author) as user meta
|
||||
* `ddhh_provider_logo`, not on the job post itself.
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class DDHH_JM_Tag_Job_Logo extends \Elementor\Core\DynamicTags\Data_Tag {
|
||||
|
||||
public function get_name(): string {
|
||||
return 'ddhh-job-logo';
|
||||
}
|
||||
|
||||
public function get_title(): string {
|
||||
return 'Logo';
|
||||
}
|
||||
|
||||
public function get_group(): array {
|
||||
return array( DDHH_JM_Elementor_Tags::GROUP_SLUG );
|
||||
}
|
||||
|
||||
public function get_categories(): array {
|
||||
return array( \Elementor\Modules\DynamicTags\Module::IMAGE_CATEGORY );
|
||||
}
|
||||
|
||||
protected function register_controls(): void {
|
||||
$this->add_control(
|
||||
'fallback',
|
||||
array(
|
||||
'label' => 'Fallback',
|
||||
'type' => \Elementor\Controls_Manager::MEDIA,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function get_value( array $options = array() ): array {
|
||||
$post = get_post( get_the_ID() );
|
||||
$image_id = $post ? get_user_meta( $post->post_author, 'ddhh_provider_logo', true ) : '';
|
||||
|
||||
if ( $image_id ) {
|
||||
$url = wp_get_attachment_image_url( $image_id, 'full' );
|
||||
if ( $url ) {
|
||||
return array(
|
||||
'id' => (int) $image_id,
|
||||
'url' => $url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fallback = $this->get_settings( 'fallback' );
|
||||
if ( ! empty( $fallback['id'] ) ) {
|
||||
return $fallback;
|
||||
}
|
||||
|
||||
return array(
|
||||
'id' => 0,
|
||||
'url' => '',
|
||||
);
|
||||
}
|
||||
}
|
||||
41
includes/elementor-tags/class-tag-job-type.php
Normal file
41
includes/elementor-tags/class-tag-job-type.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Elementor dynamic tag: Art (job_type).
|
||||
*
|
||||
* Maps raw select values to German display labels.
|
||||
*
|
||||
* @package DDHH_Job_Manager
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class DDHH_JM_Tag_Job_Type extends \Elementor\Core\DynamicTags\Tag {
|
||||
|
||||
private const LABELS = array(
|
||||
'vollzeit' => 'Vollzeit',
|
||||
'teilzeit' => 'Teilzeit',
|
||||
'ehrenamt' => 'Ehrenamt',
|
||||
);
|
||||
|
||||
public function get_name(): string {
|
||||
return 'ddhh-job-type';
|
||||
}
|
||||
|
||||
public function get_title(): string {
|
||||
return 'Art';
|
||||
}
|
||||
|
||||
public function get_group(): array {
|
||||
return array( DDHH_JM_Elementor_Tags::GROUP_SLUG );
|
||||
}
|
||||
|
||||
public function get_categories(): array {
|
||||
return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
|
||||
}
|
||||
|
||||
public function render(): void {
|
||||
$raw = get_post_meta( get_the_ID(), 'job_type', true );
|
||||
$label = self::LABELS[ $raw ] ?? $raw;
|
||||
echo esc_html( $label );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user