Fix lỗi Undefined index: captcha_area_comm nukeviet 4.0

Lỗi Undefined index: captcha_area_comm xuất hiện ở các module phiên bản thấp khi database coment đã có thay đổi. Thực hiện các bước dưới đây để xử lý cảnh báo
1) Xóa comment của module cũ đi nếu có

2) Thêm đoạn sau vào file modulesmodule_namefuncsdetail.php

// comment
define( 'NV_COMM_ID', $news_contents['id'] ); // Bắt buộc

define( 'NV_COMM_ALLOWED', $news_contents['allowed_comm'] ); // Không bắt buộc          

define( 'NV_COMM_AREA', 0 ); // Không bắt buộc

require_once NV_ROOTDIR . '/modules/comment/comment.php';

Trong đó:
$news_contents[‘id’]: là id của bài viết
$news_contents[‘allowed_comm’]: Cho phép ai bình luận (

  • 0 <===> Không cho ai bình luận
  • 1 <===> Tất cả mọi người
  • 2 <===> Chỉ có thành viên site

NV_COMM_AREA: Khu vực comment, nếu module chỉ có 1 khu vực duy nhất thì thiết lập define( ‘NV_COMM_AREA’, 0 );

Nếu module có nhiều khu vực comment thì cần thiết mập mỗi khu vực 1 NV_COMM_AREA, với giá trị khác nhau lớn hơn 0

Xem Thêm : Hướng dẫn tải icon Flaticon không cần tài khoản Premium

3) Trong file modules/module_name/theme.php hoặc themes/theme_name/modules/module_name/theme.php

Tìm đến đoạn của function hiển thị giao diện

$xtpl->parse( 'main' );

Thêm đoạn sau

if( defined( 'NV_COMM_URL' ) )

{

$xtpl->assign( 'NV_COMM_URL', NV_COMM_URL );

$xtpl->parse( 'main.comment' );

}

Trong giao diện html thêm đoạn sau

Xem Thêm : Share theme flatesome mỹ phẩm miễn phí

4)  Trong file action tạo CSDL (modules/ten-module/action_mysql.php) của module cần thêm đoạn code sau để tạo dữ liệu cài đặt cho module

// Comments

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'auto_postcomm', '1')";

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'allowed_comm', '3')";

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'setcomm', '2')";

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'activecomm', '1')";

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'emailcomm', '1')";

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'adminscomm', '')";

$sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . $lang . "', '" . $module_name . "', 'sortcomm', '0')";

5)  Nếu module đã tồn tại bạn cần tạo file php, ví dụ update-sql.php với nội dung bên dưới, đặt ngang hàng với file index.php

/**
* @Project NUKEVIET 4.x
* @Author VINADES.,JSC (contact@vinades.vn)
* @Copyright (C) 2014 VINADES.,JSC. All rights reserved
* @License GNU/GPL version 2 or any later version
* @Createdate Sat, 08 Feb 2014 06:33:39 GMT
*/
define('NV_SYSTEM', true);
require str_replace(DIRECTORY_SEPARATOR, '/', dirname(__file__)) . '/mainfile.php';
require NV_ROOTDIR . '/includes/core/user_functions.php';
if ( defined( 'NV_IS_SPADMIN' ) )
{
    // Comments
    $module_name = 'page';// Sửa ứng với module
    $sql_create_module = array();
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'auto_postcomm', '1')";
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'allowed_comm', '3')";
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'setcomm', '2')";
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'activecomm', '1')";
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'emailcomm', '1')";
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'adminscomm', '')";
    $sql_create_module[] = "INSERT INTO " . NV_CONFIG_GLOBALTABLE . " (lang, module, config_name, config_value) VALUES ('" . NV_LANG_DATA . "', '" . $module_name . "', 'sortcomm', '0')";
    foreach( $sql_create_module as $_sql )
    {
        $db->query( $_sql );
    }
    die( 'Thuc hien nang cap xong, hay xoa file nay ngay' );
}
else
{
    die( 'Can thuc hien voi quyen admin toi cao' );
}

Đăng nhập bằng tài khoản quản trị tối cao và nhập đường dẫn: http://yourdomain.com/update-sql.php

Sau khi nhận được thông báo “Thực hiện nâng cấp thành công”, tiến hành xóa file này khỏi host.

Nguồn: https://vncode.info
Danh mục: Thủ Thuật Chia Sẻ Hay

Related Posts

Code hiệu ứng icon twitter hoạt động khi hover

Có thể bạn quan tâm Hướng dẫn tạo Line Chart thật dễ dàng với Chartjs 19 trang website chia sẽ html 5 miễn phí Chia sẻ theme…

Hướng dẫn phân trang sản phẩm bằng shortcode page woocomere

Có thể bạn quan tâm Hướng remove slug đường dẫn danh mục sản phẩm wordpress Chia sẻ module cho thuê phòng trọ nukeviet Hướng dẫn tải icon…

Hướng dẫn tạo Line Chart thật dễ dàng với Chartjs

ChartJS là gì? Chart.js là một thư viện mã nguồn mở hỗ trợ các loại biểu đồ: bar, line, area, pie (doughnut), radar, polar… ChartJS mặc định là…

Code Pháo hoa Javacript

Có thể bạn quan tâm Chia sẻ theme TMDT di động việt wordpress Chia sẻ module cho thuê phòng trọ nukeviet Hướng dẫn xử lý ký tự…

Hiệu ứng slider nhấp đôi miễn phí

Có thể bạn quan tâm Image Hotspot – A WordPress Plugin Chia sẻ giao diện bán hoa tươi nukeviet cms Hiệu ứng slider nhấp đôi miễn phí…

Top 10 những framework date time html thường được sử dụng

Có thể bạn quan tâm 19 trang website chia sẽ html 5 miễn phí Lấy lại mật khẩu đăng nhập quản trị trong wordpress Hướng dẫn phân…