From 6ab7d934a9528290d6ba5ed1e1f06ce15470c8f7 Mon Sep 17 00:00:00 2001 From: AK Delfin Date: Fri, 12 Apr 2024 21:04:43 +0300 Subject: [PATCH] correct pinned post --- frontend/dist/assets/main.css | 17 +++++ frontend/src/styles/components/about.css | 8 ++ functions.php | 94 +++++++++++++++++------- 3 files changed, 92 insertions(+), 27 deletions(-) diff --git a/frontend/dist/assets/main.css b/frontend/dist/assets/main.css index e5d3b95..362dc95 100644 --- a/frontend/dist/assets/main.css +++ b/frontend/dist/assets/main.css @@ -1590,6 +1590,23 @@ button { color: #2f2f2f; } + +.wp-authors{ + position: relative !important; +} + +.wp-authors IMG{ + height: auto; +} + + +.edition-title{ + font-weight: 700; + font-size: 2rem; + line-height: 2.4rem; +} + + @media (max-width: 767px) { .about { padding: 1.5rem 0.5rem; diff --git a/frontend/src/styles/components/about.css b/frontend/src/styles/components/about.css index c4164ec..f9a9503 100644 --- a/frontend/src/styles/components/about.css +++ b/frontend/src/styles/components/about.css @@ -63,6 +63,14 @@ color: #2f2f2f; } + +.edition-title{ + font-weight: 700; + font-size: 2rem; + line-height: 2.4rem; +} + + @media (max-width: 767px) { .about { padding: 1.5rem 0.5rem; diff --git a/functions.php b/functions.php index 18ac0b2..3bf8649 100644 --- a/functions.php +++ b/functions.php @@ -601,45 +601,85 @@ function custom_meta_tags() { } -add_action('wpcf7_before_send_mail', 'my_custom_contact_form_handler', 10, 3); -function my_custom_contact_form_handler($contact_form, $abort, $submission) { - - - // Получаем ID формы - $form_id = $contact_form->id(); - - - if ( $form_id == '0ddb83c' ) { - - // Получаем данные формы - $submission = WPCF7_Submission::get_instance(); +add_action('wpcf7_mail_sent', 'my_custom_mail_sent' ); + +function my_custom_mail_sent( $contact_form ){ - if ($submission) { - - $posted_data = $submission->get_posted_data(); + $log_file = WP_CONTENT_DIR . '/contact.log'; - // Подключаемся к базе данных WordPress - global $wpdb; + $form_id = $contact_form->id(); - // Определяем таблицу в базе данных WordPress в зависимости от ID формы - $table_name = $wpdb->prefix . 'subusers'; + //if ( $form_id == '19' ) { - $wpdb->insert( + $submission = WPCF7_Submission::get_instance(); + $posted_data = $submission->get_posted_data(); + + $mail = $posted_data['your-email']; + + global $wpdb; + $table_name = $wpdb->prefix . 'subusers'; + $hash = md5('775+'.$mail); + + $query = $wpdb->prepare("SELECT * FROM $table_name WHERE mail = %s", $mail); + $result = $wpdb->get_row($query); + + if ( !$result ) { //аdd to table + + $result = $wpdb->insert( $table_name, array( - 'mail' => $posted_data['your-email'], + 'mail' => $mail, 'status' => 0, - 'date' => current_time('mysql') + 'date' => current_time('mysql'), + 'hash' => $hash, ), array( - '%s', // Формат для строкового поля - '%d', // Формат для цифрового поля - '%s' // Формат для поля с датой и временем + '%s', + '%d', + '%s', + '%s' ) ); + } - } - } + + // } + + $hash_link = home_url().'/subscript?id='.$hash; + $subject = 'Подписка на рассылку АгроЭксперт'; + $message = " +Здравствуйте!\n +Для подтверждения подписки на нашу рассылку перейдите по ссылке ниже\n +$hash_link.\n\n +Если вы не отправляли заявку просто проигнорируйте это письмо."; + + $headers = array('Content-Type: text/plain; charset=UTF-8'); + + // Отправка письма + wp_mail($mail, $subject, $message, $headers); + + echo '

Благодарим за интерес к нашему изданию!

+

На Вашу почту отправлено письмо для подтверждения подписки.

'; + + + + return; + } + +function agroxpert_send_smtp_email( PHPMailer $phpmailer ) { + $phpmailer->isSMTP(); + $phpmailer->Host = 'mail.vetandlife.ru'; + $phpmailer->SMTPAuth = true; + $phpmailer->Port = 465; + $phpmailer->Username = 'news@mail.agroexpert.press'; + $phpmailer->Password = 'O6K!]aZDNJ'; + $phpmailer->SMTPSecure = 'ssl'; + $phpmailer->From = 'news@mail.agroexpert.press'; + $phpmailer->FromName = 'Ветеринария и жизнь'; +} + + +add_action( 'phpmailer_init', 'agroxpert_send_smtp_email' ); \ No newline at end of file