add_action('user_register', 'log_user_creation_details', 10, 2);

function log_user_creation_details($user_id, $userdata) {
    // Thu thập thông tin chi tiết
    $time       = current_time('Y-m-d H:i:s');
    $username   = isset($userdata['user_login']) ? $userdata['user_login'] : 'N/A';
    $email      = isset($userdata['user_email']) ? $userdata['user_email'] : 'N/A';
    $role       = isset($userdata['role']) ? $userdata['role'] : (isset($userdata['roles']) ? implode(', ', $userdata['roles']) : 'N/A');
    
    // Lấy thông tin Request
    $ip         = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'N/A';
    $request_uri= isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'N/A';
    $method     = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'N/A';
    $referer    = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Direct Access / None';
    $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'N/A';

    // Xác định dấu hiệu nguồn gọi (REST API hay Form đăng ký)
    $source_type = 'Standard Request';
    if (defined('REST_REQUEST') && REST_REQUEST) {
        $source_type = 'REST API Request';
    } elseif (strpos($request_uri, 'wp-login.php') !== false) {
        $source_type = 'wp-login.php Register Form';
    } elseif (strpos($request_uri, 'wc-ajax') !== false || strpos($request_uri, 'checkout') !== false) {
        $source_type = 'WooCommerce Checkout/Account';
    }

    // Định dạng nội dung Log
    $log_entry  = "==================================================\n";
    $log_entry .= "TIME         : {$time}\n";
    $log_entry .= "USER ID      : {$user_id}\n";
    $log_entry .= "USERNAME     : {$username}\n";
    $log_entry .= "EMAIL        : {$email}\n";
    $log_entry .= "ROLE         : {$role}\n";
    $log_entry .= "IP ADDRESS   : {$ip}\n";
    $log_entry .= "TYPE         : {$source_type}\n";
    $log_entry .= "REQUEST URI  : [{$method}] {$request_uri}\n";
    $log_entry .= "REFERER      : {$referer}\n";
    $log_entry .= "USER AGENT   : {$user_agent}\n";
    $log_entry .= "==================================================\n\n";

    // Đường dẫn file log
    $log_file = WP_CONTENT_DIR . '/create_user_log.txt';

    // Ghi file theo dạng append (nối tiếp)
    error_log($log_entry, 3, $log_file);
}<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//abcdigi.marketing/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://abcdigi.marketing/post-sitemap.xml</loc>
		<lastmod>2026-08-09T19:35:45+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/page-sitemap.xml</loc>
		<lastmod>2026-08-09T12:26:47+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/product-sitemap.xml</loc>
		<lastmod>2026-07-25T09:45:22+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/courses-sitemap.xml</loc>
		<lastmod>2026-07-25T09:51:08+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/lesson-sitemap1.xml</loc>
		<lastmod>2026-07-24T09:22:16+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/lesson-sitemap2.xml</loc>
		<lastmod>2026-07-19T03:15:24+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/tutor_quiz-sitemap.xml</loc>
		<lastmod>2026-04-24T15:44:39+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/category-sitemap.xml</loc>
		<lastmod>2026-08-09T19:35:45+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/video-sitemap.xml</loc>
		<lastmod>2026-08-09T12:26:47+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://abcdigi.marketing/local-sitemap.xml</loc>
		<lastmod>2021-08-02T20:23:21+07:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Rank Math SEO Plugin (c) Rank Math - rankmath.com -->