add_action('admin_post_fluent_sync_front_clone', function() { $user_id = get_current_user_id(); if (!$user_id) wp_die('Invalid request'); check_admin_referer('fluent_sync_clone_' . $user_id, '_wpnonce'); $level_id = isset($_GET['level_id']) ? intval($_GET['level_id']) : 0; $current_level = pmpro_getMembershipLevelForUser($user_id); // Verify membership if (!$current_level || $current_level->id !== $level_id) { wp_die('Membership verification failed'); } // Generate new site slug (e.g., wped500123) $prefix = 'wped5'; // Adjust based on level $new_slug = $prefix . str_pad(rand(1000, 9999), 4, '0', STR_PAD_LEFT); // Execute clone (simplified example) $command = sprintf( '/bin/bash /path/to/clone-site.sh %s %d %d', escapeshellarg($new_slug), $level_id, $user_id ); exec($command, $output, $status); // On success, record clone if ($status === 0) { $clones = get_user_meta($user_id, 'fluent_sync_clones', true) ?: []; $clones[] = [ 'slug' => $new_slug, 'url' => "https://stagingsite-ct.com/{$new_slug}", 'time' => time() ]; update_user_meta($user_id, 'fluent_sync_clones', $clones); wp_redirect(add_query_arg('clone_status', 'success', wp_get_referer())); } else { wp_redirect(add_query_arg('clone_status', 'failed', wp_get_referer())); } exit; });
Warning: Cannot modify header information - headers already sent by (output started at /home/itstkaxa/stagingsite-ct.com/wp-content/plugins/fluent-sync/includes/clone-hooks.php:1) in /home/itstkaxa/stagingsite-ct.com/wp-content/plugins/paid-memberships-pro/adminpages/reports/logins.php on line 458

Warning: Cannot modify header information - headers already sent by (output started at /home/itstkaxa/stagingsite-ct.com/wp-content/plugins/fluent-sync/includes/clone-hooks.php:1) in /home/itstkaxa/stagingsite-ct.com/wp-includes/pluggable.php on line 1450

Warning: Cannot modify header information - headers already sent by (output started at /home/itstkaxa/stagingsite-ct.com/wp-content/plugins/fluent-sync/includes/clone-hooks.php:1) in /home/itstkaxa/stagingsite-ct.com/wp-includes/pluggable.php on line 1453