From 22be9e82d4e6156d229e89e7283fd7152a1afedb Mon Sep 17 00:00:00 2001 From: Vij Project Date: Thu, 27 Feb 2025 21:50:47 +0300 Subject: [PATCH] add new ver --- blocks/header-pets.php | 5 +---- blocks/social-buttons.php | 2 +- footer-pets.php | 8 +------- footer.php | 9 ++------- functions.php | 20 ++++++++++++++++++-- helpers/number_title.php | 6 ++++-- page-subscript.php | 5 +++-- partials/formsubscript.php | 7 +++++++ partials/social_footer.php | 2 +- vite.config.php | 2 +- 10 files changed, 39 insertions(+), 27 deletions(-) diff --git a/blocks/header-pets.php b/blocks/header-pets.php index cca217a..fe4d552 100644 --- a/blocks/header-pets.php +++ b/blocks/header-pets.php @@ -53,10 +53,7 @@
  • - - - - +
  • diff --git a/blocks/social-buttons.php b/blocks/social-buttons.php index c780bdc..a79fa94 100644 --- a/blocks/social-buttons.php +++ b/blocks/social-buttons.php @@ -2,7 +2,7 @@ - + @@ -62,7 +57,7 @@ window.yaContextCb.push(()=>{
    - +
    diff --git a/functions.php b/functions.php index 473ec3c..9dd7538 100644 --- a/functions.php +++ b/functions.php @@ -4,6 +4,9 @@ if (! defined( 'ABSPATH' )) { exit; } +define('YA_TOKEN', 'y0_AgAAAAA5ZMbXAAjnxwAAAADXZGKqufBi9E2_TnG4n9l_K0OjYOAukmk'); +define('YA_COUNTER', '56480275'); + // Полностью отключить XML-RPC add_filter( 'xmlrpc_enabled', '__return_false' ); @@ -23,7 +26,7 @@ function redirect_non_admin_users() { $current_user = wp_get_current_user(); // Проверяем, если пользователь не является администратором - if (in_array('subscriber', $current_user->roles) || in_array('author', $current_user->roles)) { + if ( in_array('subscriber', $current_user->roles) ) { // Если это запрос к административной панели или если пользователь пытается получить доступ к wp-admin if (is_admin()) { // Перенаправляем на главную страницу сайта @@ -1066,7 +1069,7 @@ add_filter('the_content', 'convert_images_to_amp'); // подписчики на главную -add_action('admin_init', 'restrict_subscriber_admin_access'); +//add_action('admin_init', 'restrict_subscriber_admin_access'); function restrict_subscriber_admin_access() { // Проверяем, что пользователь вошел в систему и имеет роль 'subscriber' if (current_user_can('subscriber')) { @@ -1076,3 +1079,16 @@ function restrict_subscriber_admin_access() { } } + +#авторы сохраняют только в черновики +function restrict_author_publish_posts( $data ) { + // Проверяем, что текущий пользователь - автор + if ( current_user_can( 'author' ) && $data['post_status'] == 'publish' ) { + // Отключаем публикацию для авторов + $data['post_status'] = 'draft'; // Сохраняем как черновик + } + return $data; +} +add_filter( 'wp_insert_post_data', 'restrict_author_publish_posts' ); + + diff --git a/helpers/number_title.php b/helpers/number_title.php index dd3e67a..6ddee03 100644 --- a/helpers/number_title.php +++ b/helpers/number_title.php @@ -9,10 +9,12 @@ function number_info($title){ //echo $number; $name = 'vizh_'.$number.'_'.ru2enmonths($items[3]).'_'.$items[4]; + //echo '

    '.$name.'

    '; $findpdf = db_get("SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1"); - - if (isset($findpdf ['guid'])){ + //echo "SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1"; + + if (isset($findpdf['guid'])){ $res['guid'] = $findpdf['guid']; $res['year'] = $items[4]; $res['number'] = $number; diff --git a/page-subscript.php b/page-subscript.php index 7c747ee..a102992 100644 --- a/page-subscript.php +++ b/page-subscript.php @@ -36,6 +36,7 @@ elseif( !isset($_POST['addrhash']) || $_POST['addrhash'] !== adddr_hash() ){ elseif (isset($_POST['email'])) { + $email = strtolower(trim($_POST['email'])); $email = sanitize_text_field($email); @@ -46,7 +47,7 @@ elseif (isset($_POST['email'])) { $add_sub_sql = "INSERT INTO {$wpdb->prefix}subusers (mail, status, hash, date) VALUES ('$email', '0', '$hash', '$date_insert')"; - $result = $wpdb->get_results($add_sub_sql); + //$result = $wpdb->get_results($add_sub_sql); $hash_link = home_url().'/subscript?id='.$hash; $to = $email; @@ -60,7 +61,7 @@ $hash_link.\n\n $headers = array('Content-Type: text/plain; charset=UTF-8'); // Отправка письма - wp_mail($to, $subject, $message, $headers); + //wp_mail($to, $subject, $message, $headers); echo '

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

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

    '; diff --git a/partials/formsubscript.php b/partials/formsubscript.php index 9d20a64..51259d6 100755 --- a/partials/formsubscript.php +++ b/partials/formsubscript.php @@ -1,3 +1,10 @@ + +
    diff --git a/partials/social_footer.php b/partials/social_footer.php index a95338d..00dcc3b 100755 --- a/partials/social_footer.php +++ b/partials/social_footer.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/vite.config.php b/vite.config.php index e3cd616..c35555a 100755 --- a/vite.config.php +++ b/vite.config.php @@ -33,7 +33,7 @@ add_action( 'wp_enqueue_scripts', function () { $style_ver = filemtime(get_template_directory() . $fstyle); $script_ver = filemtime(get_template_directory() . $fscript); - wp_enqueue_style('vij-style', get_template_directory_uri() . $fstyle, array(), $style_ver); + wp_enqueue_style('vij-style', get_template_directory_uri() . $fstyle, array(), $style_ver.'8'); wp_enqueue_script('vij-script', get_template_directory_uri() . $fscript, array(), $script_ver, 5); }