'; echo '
Sie müssen angemeldet sein, um diese Seite anzuzeigen.
'; echo ''; return; } $current_user = wp_get_current_user(); if ( ! in_array( 'ddhh_provider', $current_user->roles, true ) ) { echo ''; return; } // Handle logo upload if ( isset( $_POST['ddhh_upload_logo'] ) && isset( $_POST['ddhh_logo_nonce'] ) && wp_verify_nonce( $_POST['ddhh_logo_nonce'], 'ddhh_logo_upload' ) ) { if ( ! empty( $_FILES['ddhh_logo_file'] ) && $_FILES['ddhh_logo_file']['error'] === UPLOAD_ERR_OK ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/image.php' ); require_once( ABSPATH . 'wp-admin/includes/media.php' ); // Validate file type $allowed_types = array( 'image/jpeg', 'image/png', 'image/jpg' ); $file_type = $_FILES['ddhh_logo_file']['type']; if ( in_array( $file_type, $allowed_types, true ) ) { $upload = wp_handle_upload( $_FILES['ddhh_logo_file'], array( 'test_form' => false ) ); if ( isset( $upload['file'] ) && ! isset( $upload['error'] ) ) { // Insert attachment $attachment = array( 'post_mime_type' => $upload['type'], 'post_title' => sanitize_file_name( $_FILES['ddhh_logo_file']['name'] ), 'post_content' => '', 'post_status' => 'inherit', ); $attachment_id = wp_insert_attachment( $attachment, $upload['file'] ); if ( ! is_wp_error( $attachment_id ) ) { // Generate metadata $attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload['file'] ); wp_update_attachment_metadata( $attachment_id, $attachment_data ); // Save to user meta update_user_meta( get_current_user_id(), 'ddhh_provider_logo', $attachment_id ); } } } } } // Handle logo removal if ( isset( $_POST['ddhh_remove_logo'] ) && isset( $_POST['ddhh_logo_nonce'] ) && wp_verify_nonce( $_POST['ddhh_logo_nonce'], 'ddhh_logo_upload' ) ) { delete_user_meta( get_current_user_id(), 'ddhh_provider_logo' ); } // Check if we're in edit mode $is_edit_mode = isset( $_GET['action'] ) && $_GET['action'] === 'edit_job' && isset( $_GET['job_id'] ); // Check if we're in deactivate mode $is_deactivate_mode = isset( $_GET['action'] ) && $_GET['action'] === 'deactivate_job' && isset( $_GET['job_id'] ); // Check if we're in new job mode $is_new_job_mode = isset( $_GET['action'] ) && $_GET['action'] === 'new_job'; if ( $is_edit_mode ) { $job_id = absint( $_GET['job_id'] ); $form_id = DDHH_JM_Formidable::get_job_edit_form_id(); if ( $form_id ) { // Get post data $post = get_post( $job_id ); if ( ! $post || 'job_offer' !== $post->post_type || absint( $post->post_author ) !== get_current_user_id() ) { echo ''; return; } // Get field IDs $fields = FrmField::getAll( array( 'fi.form_id' => $form_id ), 'field_order' ); $field_params = array(); foreach ( $fields as $field ) { $field_value = ''; switch ( $field->field_key ) { case 'job_title2': $field_value = $post->post_title; break; case 'job_description2': $field_value = $post->post_content; break; case 'job_location2': $field_value = get_post_meta( $job_id, 'job_location', true ); break; case 'job_type2': $field_value = get_post_meta( $job_id, 'job_type', true ); break; case 'job_deadline2': $field_value = get_post_meta( $job_id, 'job_deadline', true ); break; case 'job_contact_email2': $field_value = get_post_meta( $job_id, 'job_contact_email', true ); break; } if ( ! empty( $field_value ) ) { $field_params[ $field->id ] = $field_value; } } ?>| Titel | Status | Standort | Art | Aktionen |
|---|---|---|---|---|
| 'edit_job', 'job_id' => $post_id, 'id_param' => $post_id, // For Formidable form action ), $dashboard_url ); echo 'Bearbeiten'; } // View link - only for published posts if ( 'publish' === $post_status ) { echo ' Ansehen'; } // Deactivate link - only for published posts if ( 'publish' === $post_status ) { $dashboard_url = home_url( '/anbieter-dashboard/' ); $deactivate_url = add_query_arg( array( 'action' => 'deactivate_job', 'job_id' => $post_id, ), $dashboard_url ); echo ' Deaktivieren'; } ?> |
Sie haben noch keine Stellenangebote erstellt.