diff --git a/wp-content/plugins/gamepulse-newsletter/gamepulse-newsletter.php b/wp-content/plugins/gamepulse-newsletter/gamepulse-newsletter.php new file mode 100644 index 0000000..a154d0a --- /dev/null +++ b/wp-content/plugins/gamepulse-newsletter/gamepulse-newsletter.php @@ -0,0 +1,140 @@ +prefix . 'gamepulse_subscriptions'; + $charset_collate = $wpdb->get_charset_collate(); + + $sql = "CREATE TABLE IF NOT EXISTS $table_name ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + email varchar(100) NOT NULL, + created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL, + PRIMARY KEY (id), + UNIQUE KEY email (email) + ) $charset_collate;"; + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($sql); +} + +// Shortcode to display the form +add_shortcode('gamepulse_newsletter', 'gamepulse_newsletter_form_shortcode'); +function gamepulse_newsletter_form_shortcode() { + ob_start(); + ?> +
+ + 'Please enter a valid email address.']); + } + + global $wpdb; + $table_name = $wpdb->prefix . 'gamepulse_subscriptions'; + + // Check if already subscribed + $exists = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $table_name WHERE email = %s", $email)); + + if ($exists) { + wp_send_json_error(['message' => 'You are already subscribed!']); + } + + $inserted = $wpdb->insert( + $table_name, + ['email' => $email], + ['%s'] + ); + + if ($inserted) { + // Send notification to admin using MailService + if (file_exists(ABSPATH . 'mail/MailService.php')) { + require_once ABSPATH . 'mail/MailService.php'; + $site_name = get_bloginfo('name'); + MailService::sendMail( + null, // Fallback to MAIL_TO + "New Subscriber for $site_name", + "A new user has subscribed to your newsletter: $email
", + "A new user has subscribed to your newsletter: $email" + ); + } + + wp_send_json_success(['message' => 'Thank you for subscribing!']); + } else { + wp_send_json_error(['message' => 'Subscription failed. Please try again later.']); + } +} diff --git a/wp-content/themes/twentytwentyfive-child/functions.php b/wp-content/themes/twentytwentyfive-child/functions.php new file mode 100644 index 0000000..215f6ed --- /dev/null +++ b/wp-content/themes/twentytwentyfive-child/functions.php @@ -0,0 +1,6 @@ +get('Version')); +} +add_action('wp_enqueue_scripts', 'twentytwentyfive_child_enqueue_styles'); diff --git a/wp-content/themes/twentytwentyfive-child/style.css b/wp-content/themes/twentytwentyfive-child/style.css new file mode 100644 index 0000000..2e36960 --- /dev/null +++ b/wp-content/themes/twentytwentyfive-child/style.css @@ -0,0 +1,32 @@ +/* +Theme Name: GamePulse Child +Theme URI: https://flatlogic.com/ +Description: Child theme for the GamePulse blog. +Author: Gemini +Template: twentytwentyfive +Version: 1.0.0 +*/ + +body { + background-color: #0f0f0f; + color: #e0e0e0; +} + +h1, h2, h3, h4, h5, h6 { + color: #ffffff; + font-family: 'Inter', sans-serif; +} + +a { + color: #E63946; + text-decoration: none; +} + +a:hover { + color: #f1faee; +} + +.wp-block-heading { + border-left: 4px solid #E63946; + padding-left: 15px; +}