Compare commits

...

5 Commits

Author SHA1 Message Date
55a1871a25 forgot to change version number again 2026-03-14 19:32:34 +01:00
ef7c5ccec8 replaced comment form for a custom one 2026-03-14 19:31:12 +01:00
00c23b43de the previous one is a fatal error 2026-03-14 13:44:41 +01:00
fb08e2adad previous one didnt work, maybe this 2026-03-14 13:42:19 +01:00
4809603a2f possibly fixed comment form 2026-03-14 13:38:19 +01:00
6 changed files with 126 additions and 82 deletions

View File

@@ -28,6 +28,15 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core {
$this->loader->add_filter( 'registration_errors', $this, 'registration_errors', 10, 3 ); $this->loader->add_filter( 'registration_errors', $this, 'registration_errors', 10, 3 );
$this->loader->add_filter( 'comment_post', $this, 'validate_comment' ); $this->loader->add_filter( 'comment_post', $this, 'validate_comment' );
$this->loader->add_action( 'init', $this, 'remove_filters' );
}
public function remove_filters() {
remove_all_filters('comment_form_defaults');
remove_all_filters('comment_form_top');
remove_all_filters('comment_form_before');
remove_all_filters('comment_form_after');
} }
public function add_user_new_fields() { public function add_user_new_fields() {
@@ -169,15 +178,6 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core {
'company', 'company',
sanitize_text_field($_POST['company']) sanitize_text_field($_POST['company'])
); );
if ( ! empty( $_POST['name'] ) && trim( $_POST['name'] ) != '' ) {
add_comment_meta(
$id,
'name',
sanitize_text_field($_POST['name'])
);
}
return true; return true;
} }
} }

View File

@@ -9,7 +9,7 @@
* Plugin Name: PartnerExpo Core * Plugin Name: PartnerExpo Core
* Plugin URI: https://partnerexpo.eu * Plugin URI: https://partnerexpo.eu
* Description: A PartnerEXPO oldal belső pluginja * Description: A PartnerEXPO oldal belső pluginja
* Version: 1.1.8 * Version: 1.1.9
* Author: Juhász Levente * Author: Juhász Levente
* Author URI: https://github.com/Duskell/ * Author URI: https://github.com/Duskell/
* License: GPL-2.0+ * License: GPL-2.0+
@@ -23,7 +23,7 @@ if ( ! defined( 'WPINC' ) ) {
die; die;
} }
define( 'PARTNEREXPO_CORE_VERSION', '1.1.8' ); define( 'PARTNEREXPO_CORE_VERSION', '1.1.9' );
function activate_partnerexpo_core() { function activate_partnerexpo_core() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-partnerexpo-core-activator.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-partnerexpo-core-activator.php';

View File

@@ -57,12 +57,19 @@ class Partnerexpo_Core_Public {
return ob_get_clean(); return ob_get_clean();
} }
public function comments_shortcode() { public function comments_shortcode($atts) {
wp_enqueue_style( $this->plugin_name . '-comments-css' ); wp_enqueue_style( $this->plugin_name . '-comments-css' );
wp_enqueue_script( $this->plugin_name . '-comments-js' ); wp_enqueue_script( $this->plugin_name . '-comments-js' );
// wp_enqueue_style( $this->plugin_name . '-multiselect-css' ); // wp_enqueue_style( $this->plugin_name . '-multiselect-css' );
// wp_enqueue_script( $this->plugin_name . '-multiselect-js' ); // wp_enqueue_script( $this->plugin_name . '-multiselect-js' );
$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'] );
ob_start(); ob_start();
include plugin_dir_path( __FILE__ ) . 'partials/partnerexpo-core-public-comments.php'; include plugin_dir_path( __FILE__ ) . 'partials/partnerexpo-core-public-comments.php';
return ob_get_clean(); return ob_get_clean();

View File

@@ -1,3 +1,13 @@
#pexpo-custom-comment-form {
width: 100%;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.pexpo-core-comments-title { .pexpo-core-comments-title {
text-align: center; text-align: center;
font-size: 2rem; font-size: 2rem;
@@ -105,6 +115,7 @@
border-radius: 15px; border-radius: 15px;
padding: 20px; padding: 20px;
height: fit-content; height: fit-content;
margin-top: 50px;
& .pexpo-core-com-form-title { & .pexpo-core-com-form-title {
margin: 0 0 20px 0; margin: 0 0 20px 0;
@@ -146,6 +157,24 @@
margin: 50px 0; margin: 50px 0;
} }
.pexpo-core-submit-wrapper {
display: flex;
justify-content: center;
margin: 40px;
& .submit {
background-image: linear-gradient(rgb(178, 34, 34) 21%, rgb(149, 0, 0) 87%);
color: white;
border: none;
border-radius: 15px;
padding: 10px 20px;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
}
@keyframes scrolling { @keyframes scrolling {
to { to {

View File

@@ -379,9 +379,11 @@ class PartnerExpoSearch {
div.className = "pexpo-core-card"; div.className = "pexpo-core-card";
div.innerHTML = ` div.innerHTML = `
<div class="pexpo-core-imageWrap"> <div class="pexpo-core-imageWrap">
<img src="${this.escapeHtml(r.image || '')}" <a href="${this.escapeHtml(r.url)}" target="_self" rel="noopener noreferrer">
alt="${this.escapeHtml(r.title)}" <img src="${this.escapeHtml(r.image || '')}"
style="width:100%; border-radius:10px; object-fit:cover;" /> alt="${this.escapeHtml(r.title)}"
style="width:100%; border-radius:10px; object-fit:cover;" />
</a>
</div> </div>
<div class="pexpo-core-cardTop"> <div class="pexpo-core-cardTop">
<a href="${this.escapeHtml(r.url)}" class="pexpo-core-title">${this.escapeHtml(r.title)}</a> <a href="${this.escapeHtml(r.url)}" class="pexpo-core-title">${this.escapeHtml(r.title)}</a>

View File

@@ -9,81 +9,87 @@
* @package Partnerexpo_Core * @package Partnerexpo_Core
* @subpackage Partnerexpo_Core/public/partials * @subpackage Partnerexpo_Core/public/partials
*/ */
?> ?>
<div class="pexpo-core-root pexpo-core-shell" id="pexpo-core-comments-shell"> <div class="pexpo-core-comments" id="pexpo-core-comments">
<div class="pexpo-core-comments" id="pexpo-core-comments"> <div class="pexpo-core-comments-header">
<div class="pexpo-core-comments-header"> <h2 class="pexpo-core-comments-title"><?php echo esc_html__('Visszajelzések', 'partnerexpo-core'); ?></h2>
<h2 class="pexpo-core-comments-title"><?php echo esc_html__('Visszajelzések', 'partnerexpo-core'); ?></h2> </div>
</div> <div class="pexpo-core-comments-body" id="pexpo-core-comments-body">
<div class="pexpo-core-comments-body" id="pexpo-core-comments-body"> <?php
<?php $comments = get_comments([
$comments = get_comments([ 'post_id' => get_the_ID(),
'post_id' => get_the_ID(), 'status' => 'approve',
'status' => 'approve', ]);
]);
if ( ! empty( $comments ) ) {
if ( ! empty( $comments ) ) { echo '<div class="pexpo-core-comment-groups-wrapper">';
echo '<div class="pexpo-core-comment-groups-wrapper">'; if ( count( $comments ) < 3 ) {
if ( count( $comments ) < 3 ) { $groups = 6 / count( $comments );
$groups = 6 / count( $comments ); } else {
} else { $groups = 2;
$groups = 2; }
} for ($i = 0; $i < $groups; $i++) {
for ($i = 0; $i < $groups; $i++) { echo '<div class="pexpo-core-comment-group"'.($i ? ' aria-hidden="true"' : '').'>';
echo '<div class="pexpo-core-comment-group"'.($i ? ' aria-hidden="true"' : '').'>';
foreach ($comments as $comment) { foreach ($comments as $comment) {
?> ?>
<div class="pexpo-core-comment"> <div class="pexpo-core-comment">
<div class="pexpo-core-comment-content"> <div class="pexpo-core-comment-content">
<?php echo get_comment_text( $comment ); ?> <?php echo get_comment_text( $comment ); ?>
</div>
<div class="pexpo-core-comment-said_by">
<?php if ( get_comment_meta( $comment->comment_ID, 'author', true ) ): ?>
<div class="pexpo-core-comment-author">
<p><?php echo get_comment_meta( $comment->comment_ID, 'author', true ); ?></p>
</div> </div>
<div class="pexpo-core-comment-said_by"> <p>-</p>
<?php if ( get_comment_meta( $comment->comment_ID, 'name', true ) ): ?> <?php endif; ?>
<div class="pexpo-core-comment-author"> <div class="pexpo-core-comment-business">
<p><?php echo get_comment_meta( $comment->comment_ID, 'name', true ); ?></p> <p><?php echo get_comment_meta( $comment->comment_ID, 'company', true ); ?></p>
</div>
<p>-</p>
<?php endif; ?>
<div class="pexpo-core-comment-business">
<p><?php echo get_comment_meta( $comment->comment_ID, 'company', true ); ?></p>
</div>
</div> </div>
</div> </div>
<?php </div>
} <?php
echo '</div>';
} }
echo '</div>'; echo '</div>';
} else {
?>
<p class="pexpo-core-no-comments"><?php echo esc_html__('Még nincsenek visszajelzések.', 'partnerexpo-core'); ?></p>
<?php
} }
?> echo '</div>';
</div> } else {
<?php ?>
$comments_args = array( <p class="pexpo-core-no-comments"><?php echo esc_html__('Még nincsenek visszajelzések.', 'partnerexpo-core'); ?></p>
'label_submit' => __( 'Küldés', 'partnerexpo-core' ), <?php
'title_reply' => '', }
'comment_notes_after' => '',
'must_log_in' => '',
'logged_in_as' => '',
'comment_field' => '
<div class="pexpo-core-com-form-wrapper">
<h2 class="pexpo-core-com-form-title">' . _x( 'Visszajelzés küldése', 'partnerexpo_core' ) . '</h2>
<p class="pexpo-core-com-field"><label for="name">' . _x( 'Kitöltő neve', 'partnerexpo_core' ) . '</label><br />
<input type="text" id="name" name="name" aria-required="true"></p>
<p class="pexpo-core-com-field"><label for="company">' . _x( 'Cég név', 'partnerexpo_core' ) . '</label><br />
<input type="text" id="company" name="company" aria-required="true"></p>
<p class="pexpo-core-com-field"><label for="comment">' . _x( 'Hozzászólás', 'partnerexpo_core' ) . '</label><br />
<textarea id="comment" name="comment" aria-required="true" maxlength="600"></textarea></p>
</div>
',
);
comment_form( $comments_args );
?> ?>
</div> </div>
</div>
<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="pexpo-custom-comment-form">
<div class="pexpo-core-com-form-wrapper">
<h2 class="pexpo-core-com-form-title"><?php echo esc_html_x( 'Visszajelzés küldése', 'partnerexpo_core' ); ?></h2>
<div class="pexpo-core-com-field">
<label for="author"><?php echo esc_html_x( 'Kitöltő neve', 'partnerexpo_core' ); ?></label><br />
<input type="text" id="author" name="author" aria-required="true" required>
</div>
<div class="pexpo-core-com-field">
<label for="company"><?php echo esc_html_x( 'Cég név', 'partnerexpo_core' ); ?></label><br />
<input type="text" id="company" name="company" aria-required="true" required>
</div>
<div class="pexpo-core-com-field">
<label for="comment"><?php echo esc_html_x( 'Hozzászólás / Visszajelzés', 'partnerexpo_core' ); ?></label><br />
<textarea id="comment" name="comment" aria-required="true" maxlength="600" required></textarea>
</div>
<div><input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $post_id ); ?>" id="comment_post_ID"></div>
<div><input type="hidden" name="comment_parent" id="comment_parent" value="0"></div>
</div>
<div class="pexpo-core-submit-wrapper">
<button type="submit" name="submit" id="submit" class="submit"><?php _e( 'Küldés', 'partnerexpo-core' ); ?></button>
</div>
</form>
</div>