diff --git a/includes/class-partnerexpo-core-user-fields.php b/includes/class-partnerexpo-core-user-fields.php
index da5022c..8301b72 100644
--- a/includes/class-partnerexpo-core-user-fields.php
+++ b/includes/class-partnerexpo-core-user-fields.php
@@ -24,9 +24,9 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core {
$this->loader->add_action( 'personal_options_update', $this, 'save_custom_user_fields' );
$this->loader->add_action( 'edit_user_profile_update', $this, 'save_custom_user_fields' );
$this->loader->add_action( 'user_register', $this, 'add_value_after_reg' );
- $this->loader->add_action( 'register_form', $this, 'registration_form' );
$this->loader->add_filter( 'registration_errors', $this, 'registration_errors', 10, 3 );
$this->loader->add_filter( 'comment_post', $this, 'validate_comment' );
+ $this->loader->add_filter( 'wp_authenticate_user', $this, 'check_status', 30, 3 );
$this->loader->add_action( 'init', $this, 'remove_filters' );
@@ -79,7 +79,12 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core {
public function add_custom_user_fields( $user ) {
+ if( ! current_user_can( 'pexpo_manage_users' ) ) { // Custom capability, added with external plugin
+ return;
+ }
+
$company = get_user_meta( $user->ID, 'company', true );
+ $user_status = get_user_meta( $user->ID, 'user_status', true );
$logo_id = get_user_meta( $user->ID, 'company_logo_attachment_id', true );
$logo_url = $logo_id ? wp_get_attachment_url( $logo_id ) : '';
wp_enqueue_media();
@@ -102,6 +107,15 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core {
+
+ |
+
+
+ |
+
get_error_message() ), ['user_id' => $user_id] );
+ }
}
- if ( ! empty( $_POST['phone'] ) ) {
- update_user_meta(
- $user_id,
- 'phone',
- sanitize_text_field( $_POST['phone'] )
- );
+ // 3. Set the default user status
+ update_user_meta( $user_id, 'user_status', 'inactive' );
+ }
+
+ function check_status( WP_User $user ) {
+
+ $status = get_user_meta( $user->ID, 'user_status' );
+
+ if ($status && is_array($status) && isset($status[0]) && $status[0] === 'inactive') {
+ return new WP_Error( 'authentication_failed', __( 'A fiókod még nem aktív. Kérlek, várj türelemmel, amíg ellenőrizzük a regisztrációdat.', 'partnerexpo-core' ) );
}
- if ( ! empty( $_POST['phone'] ) ) {
- update_user_meta(
- $user_id,
- 'phone',
- sanitize_text_field( $_POST['phone'] )
- );
- }
-
- if ( ! empty( $_POST['gdpr'] ) ) {
- update_user_meta(
- $user_id,
- 'gdpr',
- sanitize_text_field( $_POST['gdpr'] )
- );
- }
-
- if ( ! empty( $_POST['newsletter'] ) ) {
- update_user_meta(
- $user_id,
- 'newsletter',
- sanitize_text_field( $_POST['newsletter'] )
- );
- }
-
- if ( ! empty( $_POST['company'] ) ) {
- update_user_meta(
- $user_id,
- 'company',
- sanitize_text_field( $_POST['company'] )
- );
- }
-
- if ( ! empty( $_POST['image_attachment_id'] ) ) {
- update_user_meta(
- $user_id,
- 'company_logo_attachment_id',
- absint( $_POST['image_attachment_id'] )
- );
- }
-
- update_user_meta($user_id, 'user_status', 'inactive');
+ return $user;
}
function registration_errors( $errors, $sanitized_user_login, $user_email ) {
diff --git a/includes/mc-integrations/com-form.php b/includes/mc-integrations/com-form.php
index 1e5eae0..eb712c4 100644
--- a/includes/mc-integrations/com-form.php
+++ b/includes/mc-integrations/com-form.php
@@ -68,7 +68,7 @@ class Partnerexpo_Core_Integration_Comment_Form {
return;
}
- $user_exists = $this->client->get('Contact', ['Email' => $data['email']]);
+ $user_exists = $this->client->get('Contact', ['Email' => $data['email'], 'Deleted' => 0]);
if ( ! is_array($user_exists) ) {
Logger::log(__("Kontakt létezésének lekérése sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email'], $error_text => $this->client->getLastError()]);
return;
@@ -76,6 +76,7 @@ class Partnerexpo_Core_Integration_Comment_Form {
$user_id = 0;
$has_company = true;
+ $comp_id = 0;
if ($user_exists['Count'] == 0) {
$new_contact = $this->client->put('Contact', [
@@ -94,14 +95,16 @@ class Partnerexpo_Core_Integration_Comment_Form {
} else {
$user_id = array_key_first($user_exists['Results']);
$existing_contact = $this->client->get('Contact/'.$user_id);
- if ( ! is_array($existing_contact) || ! isset($existing_contact['id']) ) {
+ if ( ! is_array($existing_contact) || ! isset($existing_contact['Id']) ) {
Logger::log(__("Kontakt adatok lekérése sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'contact_id' => $user_id, $error_text => $this->client->getLastError()]);
return;
}
+
if (!isset($existing_contact['BusinessId']) || empty($existing_contact['BusinessId'])) {
$has_company = false;
+ } else {
+ $comp_id = $existing_contact['BusinessId'];
}
-
}
if ( ! $user_id ) {
@@ -110,14 +113,12 @@ class Partnerexpo_Core_Integration_Comment_Form {
}
if ( ! $has_company ) {
- $comp_exists = $this->client->get('Contact', ['Name' => $data['company'], 'Type' => 'Business']);
- if ( ! is_array($user_exists) ) {
+ $comp_exists = $this->client->get('Contact', ['Name' => $data['company'], 'Type' => 'Business', 'Deleted' => 0]);
+ if ( ! is_array($comp_exists.,.) ) {
Logger::log(__("Kontakt létezésének lekérése sikertelen!", "partnerexpo-core"), [$com_id_text => $comment_id, 'email' => $data['email'], $error_text => $this->client->getLastError()]);
return;
}
- $comp_id = 0;
-
if ($comp_exists['Count'] == 0) {
$new_comp = $this->client->put('Contact', [
'Name' => $data['company'],
@@ -143,7 +144,8 @@ class Partnerexpo_Core_Integration_Comment_Form {
return;
}
- $card_exists = $this->client->get('Project', ['CategoryId' => $category_id, 'ContactId' => $user_id]);
+
+ $card_exists = $this->client->get('Project', ['CategoryId' => $category_id, 'ContactId' => $user_id, 'Deleted' => 0]);
if ( ! is_array($card_exists) ) {
Logger::log(__("Adatlap adatok lekérése sikertelen:", "partnerexpo-core"), [$com_id_text => $comment_id, 'contact_id' => $user_id, $error_text => $this->client->getLastError()]);
return;
@@ -193,6 +195,7 @@ class Partnerexpo_Core_Integration_Comment_Form {
Logger::log(__("Teendő létrehozása sikertelen létező adatlap esetén!", "partnerexpo-core"), [$com_id_text => $comment_id, 'project_id' => $card_id, $error_text => $this->client->getLastError()]);
}
}
+
} catch ( Exception $e ) {
Logger::log(__("Ismeretlen hiba történt a szinkronizálás során!", "partnerexpo-core"), [$com_id_text => $comment_id, 'exception' => $e->getMessage()]);
}
diff --git a/partnerexpo-core.php b/partnerexpo-core.php
index c8afb50..a1fd312 100644
--- a/partnerexpo-core.php
+++ b/partnerexpo-core.php
@@ -9,7 +9,7 @@
* Plugin Name: PartnerExpo Core
* Plugin URI: https://partnerexpo.eu
* Description: A PartnerEXPO oldal belső pluginja
- * Version: 1.1.13
+ * Version: 1.1.16
* Author: Juhász Levente
* Author URI: https://github.com/Duskell/
* License: GPL-2.0+
@@ -23,7 +23,7 @@ if ( ! defined( 'WPINC' ) ) {
die;
}
-define( 'PARTNEREXPO_CORE_VERSION', '1.1.13' );
+define( 'PARTNEREXPO_CORE_VERSION', '1.1.16' );
function activate_partnerexpo_core() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-partnerexpo-core-activator.php';
diff --git a/public/class-partnerexpo-core-public.php b/public/class-partnerexpo-core-public.php
index c218039..c119e66 100644
--- a/public/class-partnerexpo-core-public.php
+++ b/public/class-partnerexpo-core-public.php
@@ -75,14 +75,14 @@ class Partnerexpo_Core_Public {
return ob_get_clean();
}
- public function register_shortcode() {
+ public function register_shortcode($atts) {
wp_enqueue_style( $this->plugin_name . '-register-css' );
- wp_enqueue_script( $this->plugin_name . '-business-page' ); // TODO for now it references the business page js
+ wp_enqueue_script( $this->plugin_name . '-register-js' );
- // $atts = shortcode_atts( array(
- // 'post_id' => get_the_ID(),
- // ), $atts );
+ $atts = shortcode_atts( array(
+ 'post_id' => get_the_ID(),
+ ), $atts );
// // This variable is now scoped and ready for the partial
// $post_id = intval( $atts['post_id'] );
@@ -236,7 +236,7 @@ class Partnerexpo_Core_Public {
wp_register_style(
$this->plugin_name . '-register-css',
- plugin_dir_url( __FILE__ ) . 'css/comments.css',
+ plugin_dir_url( __FILE__ ) . 'css/register.css',
[],
$this->version,
'all'
@@ -281,7 +281,6 @@ class Partnerexpo_Core_Public {
true
);
-
wp_register_script(
$this->plugin_name . '-comments-js',
plugin_dir_url( __FILE__ ) . 'js/comments.js',
@@ -289,6 +288,14 @@ class Partnerexpo_Core_Public {
$this->version,
true
);
+
+ wp_register_script(
+ $this->plugin_name . '-register-js',
+ plugin_dir_url( __FILE__ ) . 'js/register.js',
+ [ 'jquery' ],
+ $this->version,
+ true
+ );
}
diff --git a/public/css/register.css b/public/css/register.css
index c91892b..c061ec0 100644
--- a/public/css/register.css
+++ b/public/css/register.css
@@ -197,6 +197,42 @@
}
+.pexpo-core-image-drop-zone {
+ position: relative;
+ border: 2px dashed #ccc;
+ border-radius: 8px;
+ padding: 40px 20px;
+ text-align: center;
+ background-color: #f9f9f9;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ margin-top: 10px;
+}
+
+.pexpo-core-image-drop-zone:hover,
+.pexpo-core-image-drop-zone.is-dragover {
+ background-color: #e1f5fe;
+ border-color: #03a9f4;
+}
+
+.pexpo-core-image-drop-zone input[type="file"] {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0;
+ cursor: pointer;
+}
+
+#pexpo-core-image-preview {
+ max-width: 200px;
+ display: none;
+ margin: 20px auto 0;
+ border-radius: 4px;
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
+}
+
@keyframes scrolling {
to {
transform: translate3d(-50%, 0, 0);
diff --git a/public/js/register.js b/public/js/register.js
new file mode 100644
index 0000000..4e5bcea
--- /dev/null
+++ b/public/js/register.js
@@ -0,0 +1,41 @@
+jQuery( document ).ready( function( $ ) {
+
+ var $dropZone = $('#pexpo-core-image-drop-zone');
+ var $fileInput = $('#pexpo-core-image-logo');
+ var $preview = $('#pexpo-core-image-preview');
+ var $dropText = $dropZone.find('.pexpo-core-image-drop-text');
+
+ // Add a class when a file is dragged over the box
+ $dropZone.on('dragover dragenter', function() {
+ $dropZone.addClass('is-dragover');
+ });
+
+ // Remove the class when the file leaves or is dropped
+ $dropZone.on('dragleave dragend drop', function() {
+ $dropZone.removeClass('is-dragover');
+ });
+
+ // Handle the file selection (Click or Drop)
+ $fileInput.on('change', function( event ) {
+ var file = event.target.files[0];
+
+ if ( file ) {
+ var reader = new FileReader();
+
+ reader.onload = function( e ) {
+ // Show the image preview
+ $preview.attr('src', e.target.result).css('display', 'block');
+
+ // Optional: Change the text inside the box
+ $dropText.text('Kép kiválasztva. Kattintson vagy húzzon ide egy újat a cseréhez.');
+ };
+
+ reader.readAsDataURL( file );
+ } else {
+ // Reset if user cancels
+ $preview.hide().attr('src', '');
+ $dropText.text('Húzza ide a képet, vagy kattintson a tallózáshoz');
+ }
+ });
+
+});
\ No newline at end of file
diff --git a/public/partials/partnerexpo-core-public-register.php b/public/partials/partnerexpo-core-public-register.php
index ff41e4a..0f65389 100644
--- a/public/partials/partnerexpo-core-public-register.php
+++ b/public/partials/partnerexpo-core-public-register.php
@@ -15,7 +15,7 @@ $complience_url = "rendszerepito.hu/adatkezeles";
?>