// ============================================ // DIRECT PHP TEST - NO AJAX // ============================================ add_action('init', 'nfs_direct_test_runner'); function nfs_direct_test_runner() { if (!current_user_can('manage_options')) { return; } if (!isset($_GET['nfs_direct_test']) || $_GET['nfs_direct_test'] !== '1') { return; } // Prevent WordPress from loading further nfs_run_direct_tests(); exit; } function nfs_run_direct_tests() { header('Content-Type: text/plain; charset=utf-8'); echo "========================================\n"; echo " NAJIBUL FOLLOW SYSTEM - DIRECT TEST\n"; echo "========================================\n"; echo " Time: " . date('Y-m-d H:i:s') . "\n"; echo " WordPress: " . get_bloginfo('version') . "\n"; echo " PHP: " . PHP_VERSION . "\n"; echo " Plugin Version: " . (defined('NAJIBUL_FOLLOW_VERSION') ? NAJIBUL_FOLLOW_VERSION : 'Not detected') . "\n"; echo "========================================\n\n"; // ============================================ // TEST 1: Check if plugin is loaded // ============================================ echo "TEST 1: Plugin Loading\n"; echo "----------------------------------------\n"; echo "NAJIBUL_FOLLOW_VERSION: " . (defined('NAJIBUL_FOLLOW_VERSION') ? NAJIBUL_FOLLOW_VERSION : '❌ NOT DEFINED') . "\n"; echo "NAJIBUL_FOLLOW_PATH: " . (defined('NAJIBUL_FOLLOW_PATH') ? NAJIBUL_FOLLOW_PATH : '❌ NOT DEFINED') . "\n"; echo "NAJIBUL_FOLLOW_MODULE_PATH: " . (defined('NAJIBUL_FOLLOW_MODULE_PATH') ? NAJIBUL_FOLLOW_MODULE_PATH : '❌ NOT DEFINED') . "\n"; echo "\n"; // ============================================ // TEST 2: Check Follow_Core class // ============================================ echo "TEST 2: Follow_Core Class\n"; echo "----------------------------------------\n"; $class_exists = class_exists('NajibulFollow\\Follow_Core'); echo "class_exists('NajibulFollow\\\\Follow_Core'): " . ($class_exists ? '✅ YES' : '❌ NO') . "\n"; if (!$class_exists) { // Try to find the file $possible_paths = [ WP_PLUGIN_DIR . '/najibul-follow-system/author-follow-system/class-follow-core.php', WP_PLUGIN_DIR . '/najibul-follow-system/class-follow-core.php', WP_PLUGIN_DIR . '/najibul-follow/author-follow-system/class-follow-core.php', WP_CONTENT_DIR . '/plugins/najibul-follow-system/author-follow-system/class-follow-core.php', ]; echo "Searching for class file...\n"; foreach ($possible_paths as $path) { echo " Checking: " . $path . " - " . (file_exists($path) ? '✅ EXISTS' : '❌ NOT FOUND') . "\n"; if (file_exists($path)) { echo " ✅ FILE FOUND: " . $path . "\n"; require_once $path; $class_exists = class_exists('NajibulFollow\\Follow_Core'); echo " After require: " . ($class_exists ? '✅ CLASS LOADED' : '❌ CLASS NOT LOADED') . "\n"; break; } } } echo "\n"; // ============================================ // TEST 3: Database Connection // ============================================ echo "TEST 3: Database Connection\n"; echo "----------------------------------------\n"; global $wpdb; try { $connected = !$wpdb->db_connect_error(); echo "Database Connected: " . ($connected ? '✅ YES' : '❌ NO') . "\n"; echo "Database Version: " . $wpdb->db_version() . "\n"; echo "Table Prefix: " . $wpdb->prefix . "\n"; } catch (Exception $e) { echo "❌ Database Error: " . $e->getMessage() . "\n"; } echo "\n"; // ============================================ // TEST 4: Check Tables // ============================================ echo "TEST 4: Database Tables\n"; echo "----------------------------------------\n"; $tables = [ 'author_followers' => $wpdb->prefix . 'author_followers', 'uafs_notification_queue' => $wpdb->prefix . 'uafs_notification_queue', 'uafs_notifications' => $wpdb->prefix . 'uafs_notifications', 'uafs_push_tokens' => $wpdb->prefix . 'uafs_push_tokens', ]; foreach ($tables as $name => $table) { $exists = $wpdb->get_var("SHOW TABLES LIKE '$table'") === $table; $rows = $exists ? (int) $wpdb->get_var("SELECT COUNT(*) FROM $table") : 0; echo $name . ": " . ($exists ? '✅ EXISTS' : '❌ MISSING') . " (Rows: " . $rows . ")\n"; } echo "\n"; // ============================================ // TEST 5: Follow Function (if class exists) // ============================================ echo "TEST 5: Follow/Unfollow Function\n"; echo "----------------------------------------\n"; if ($class_exists) { try { $core = new NajibulFollow\Follow_Core(); echo "✅ Follow_Core instantiated\n"; // Get test users $users = get_users(['number' => 2]); if (count($users) >= 2) { $author_id = $users[0]->ID; $follower_id = $users[1]->ID; $language = 'en'; echo "Author: " . $users[0]->display_name . " (ID: " . $author_id . ")\n"; echo "Follower: " . $users[1]->display_name . " (ID: " . $follower_id . ")\n"; // Check current status $status = $core->check_follow_status($author_id, $follower_id, $language); echo "Current Status: " . ($status ? 'Following' : 'Not following') . "\n"; // Test Follow echo "\n--- Testing Follow ---\n"; $follow_result = $core->follow_author($author_id, $follower_id, $language); echo "Follow Result: " . ($follow_result ? '✅ SUCCESS' : '❌ FAILED') . "\n"; // Verify in database $verify = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}author_followers WHERE author_id = %d AND follower_id = %d AND language = %s AND status = 1", $author_id, $follower_id, $language )); echo "Database Verify: " . ($verify > 0 ? '✅ Record found (' . $verify . ')' : '❌ No record found') . "\n"; // Test Unfollow echo "\n--- Testing Unfollow ---\n"; $unfollow_result = $core->unfollow_author($author_id, $follower_id, $language); echo "Unfollow Result: " . ($unfollow_result ? '✅ SUCCESS' : '❌ FAILED') . "\n"; // Verify in database $verify_unfollow = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}author_followers WHERE author_id = %d AND follower_id = %d AND language = %s AND status = 0", $author_id, $follower_id, $language )); echo "Database Verify: " . ($verify_unfollow > 0 ? '✅ Record found (' . $verify_unfollow . ')' : '⚠️ No record found (may be deleted)') . "\n"; // Clear cache $core->clear_cache($author_id, $follower_id, $language); echo "Cache Cleared: ✅\n"; } else { echo "⚠️ Need at least 2 users for follow test\n"; echo "Current users: " . count($users) . "\n"; } } catch (Exception $e) { echo "❌ Error: " . $e->getMessage() . "\n"; echo "Trace: " . $e->getTraceAsString() . "\n"; } } else { echo "❌ Cannot test follow - Follow_Core not available\n"; } echo "\n"; // ============================================ // TEST 6: Guest Follow (if class exists) // ============================================ echo "TEST 6: Guest Follow/Unfollow\n"; echo "----------------------------------------\n"; if ($class_exists) { try { $core = new NajibulFollow\Follow_Core(); $fingerprint = 'test_guest_' . time() . '_' . wp_rand(10000, 99999); $users = get_users(['number' => 1]); $author_id = $users[0]->ID; $language = 'en'; echo "Guest Fingerprint: " . $fingerprint . "\n"; echo "Author: " . $users[0]->display_name . " (ID: " . $author_id . ")\n"; // Test Guest Follow echo "\n--- Testing Guest Follow ---\n"; $follow_result = $core->follow_author($author_id, 0, $language, $fingerprint); echo "Guest Follow Result: " . ($follow_result ? '✅ SUCCESS' : '❌ FAILED') . "\n"; // Verify in database $verify = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}author_followers WHERE fallback_fingerprint = %s AND author_id = %d AND status = 1", $fingerprint, $author_id )); echo "Database Verify: " . ($verify > 0 ? '✅ Record found (' . $verify . ')' : '❌ No record found') . "\n"; // Test Guest Unfollow echo "\n--- Testing Guest Unfollow ---\n"; $unfollow_result = $core->unfollow_author($author_id, 0, $language, $fingerprint); echo "Guest Unfollow Result: " . ($unfollow_result ? '✅ SUCCESS' : '❌ FAILED') . "\n"; // Verify in database $verify_unfollow = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}author_followers WHERE fallback_fingerprint = %s AND author_id = %d AND status = 0", $fingerprint, $author_id )); echo "Database Verify: " . ($verify_unfollow > 0 ? '✅ Record found (' . $verify_unfollow . ')' : '⚠️ No record found') . "\n"; // Clear cache $core->clear_cache($author_id, 0, $language); echo "Cache Cleared: ✅\n"; } catch (Exception $e) { echo "❌ Error: " . $e->getMessage() . "\n"; } } else { echo "❌ Cannot test guest follow - Follow_Core not available\n"; } echo "\n"; // ============================================ // TEST 7: File Permissions // ============================================ echo "TEST 7: File Permissions\n"; echo "----------------------------------------\n"; $plugin_dir = WP_PLUGIN_DIR . '/najibul-follow-system/'; echo "Plugin Directory: " . $plugin_dir . "\n"; echo "Directory Exists: " . (is_dir($plugin_dir) ? '✅ YES' : '❌ NO') . "\n"; if (is_dir($plugin_dir)) { $files = [ 'najibul-follow-system.php' => $plugin_dir . 'najibul-follow-system.php', 'author-follow-system/class-follow-core.php' => $plugin_dir . 'author-follow-system/class-follow-core.php', 'author-follow-system/class-ajax-rest-api.php' => $plugin_dir . 'author-follow-system/class-ajax-rest-api.php', ]; foreach ($files as $name => $path) { $exists = file_exists($path); $readable = $exists ? is_readable($path) : false; echo $name . ": " . ($exists ? '✅ EXISTS' : '❌ MISSING') . ($exists ? ' (Readable: ' . ($readable ? '✅' : '❌') . ')' : '') . "\n"; } } echo "\n"; // ============================================ // SUMMARY // ============================================ echo "========================================\n"; echo " SUMMARY\n"; echo "========================================\n"; $issues = []; if (!defined('NAJIBUL_FOLLOW_VERSION')) { $issues[] = "❌ Plugin not loaded (NAJIBUL_FOLLOW_VERSION not defined)"; } if (!$class_exists) { $issues[] = "❌ Follow_Core class not found"; } if ($class_exists && isset($follow_result) && !$follow_result) { $issues[] = "❌ Follow function failed"; } if (empty($issues)) { echo "✅ ALL TESTS PASSED!\n"; echo "System is working correctly.\n"; } else { echo "❌ ISSUES FOUND:\n"; foreach ($issues as $issue) { echo " - " . $issue . "\n"; } } echo "\n========================================\n"; echo " END OF REPORT\n"; echo "========================================\n"; } এশিয়া কাপের জন্য নেপালের পূর্ণাঙ্গ স্কোয়াড ঘোষণা: তারুণ্য ও অভিজ্ঞতার মিশেলে চমকের অপেক্ষা তে মন্তব্যসমূহ https://najibul.com/bn/khobor/nepal-asia-cup-squad-announcement-team-players-list%e0%a6%8f%e0%a6%b6%e0%a6%bf%e0%a6%af%e0%a6%bc%e0%a6%be-%e0%a6%95%e0%a6%be%e0%a6%aa%e0%a7%87%e0%a6%b0-%e0%a6%9c%e0%a6%a8%e0%a7%8d%e0%a6%af-%e0%a6%a8/ জ্ঞানের জগতে অন্বেষণ করুন Wed, 27 Aug 2025 16:25:32 +0000 hourly 1 https://wordpress.org/?v=7.1