Plugin Directory

Changeset 3432112


Ignore:
Timestamp:
01/04/2026 01:52:20 PM (3 months ago)
Author:
samukbg
Message:

Update to version 1.1.8 - Fixed tier activation logic and credit checking system

Location:
post2podcast/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • post2podcast/trunk/README.md

    r3432101 r3432112  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.1.7
     7Stable tag: 1.1.8
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • post2podcast/trunk/includes/class-post2podcast-admin.php

    r3431746 r3432112  
    358358        $options = get_option('post2podcast_options');
    359359
    360         // Display two tier options in a clear layout
     360        // Check if self-hosted is configured (for whitelisted sites)
     361        $self_hosted_api_key = isset($options['openai_api_key']) ? $options['openai_api_key'] : '';
     362        $self_hosted_server_url = isset($options['api_base_url']) ? $options['api_base_url'] : '';
     363        $self_hosted_enabled = isset($options['self_hosted_enabled']) && $options['self_hosted_enabled'];
     364        $is_self_hosted_configured = $this->is_whitelisted && $self_hosted_enabled && !empty($self_hosted_api_key) && !empty($self_hosted_server_url);
     365
     366        // Display tier options in a clear layout
    361367        echo '<div class="post2podcast-options-container" style="display: flex; gap: 20px; flex-wrap: wrap; margin: 20px 0;">';
    362        
     368
    363369        // Option 1: Free Hosted Service
    364370        $free_credits_available = 10 - intval($free_credits_used);
    365371        $credits_display = $free_credits_available > 0 ? $free_credits_available : 0;
    366372        $free_credits_percentage = ($credits_display / 10) * 100;
    367         $is_current_free = ($subscription_status !== 'active') || (!$current_period_end_ts) || (time() > $current_period_end_ts);
     373        $is_current_free = !$is_self_hosted_configured && (($subscription_status !== 'active') || (!$current_period_end_ts) || (time() > $current_period_end_ts));
    368374       
    369375        echo '<div class="post2podcast-tier-card post2podcast-free-tier-status" style="flex: 1; min-width: 280px; ' . ($is_current_free ? 'border: 2px solid #667eea;' : '') . '">';
     
    395401
    396402        // Option 2: PRO Hosted Service
    397         $is_current_pro = $subscription_status === 'active' && $current_period_end_ts && time() < $current_period_end_ts;
     403        $is_current_pro = !$is_self_hosted_configured && $subscription_status === 'active' && $current_period_end_ts && time() < $current_period_end_ts;
    398404       
    399405        echo '<div class="post2podcast-tier-card post2podcast-pro-tier-status" style="flex: 1; min-width: 280px; ' . ($is_current_pro ? 'border: 2px solid #667eea;' : '') . '">';
     
    460466        // Option 3: Self-Hosted (only for whitelisted sites)
    461467        if ($this->is_whitelisted) {
    462             $self_hosted_api_key = isset($options['openai_api_key']) ? $options['openai_api_key'] : '';
    463             $self_hosted_server_url = isset($options['api_base_url']) ? $options['api_base_url'] : '';
    464             $self_hosted_enabled = isset($options['self_hosted_enabled']) && $options['self_hosted_enabled'];
    465             $is_self_hosted_configured = $self_hosted_enabled && !empty($self_hosted_api_key) && !empty($self_hosted_server_url);
    466 
    467468            echo '<div class="post2podcast-tier-card post2podcast-selfhosted-tier-status" style="flex: 1; min-width: 280px; ' . ($is_self_hosted_configured ? 'border: 2px solid #48bb78;' : '') . '">';
    468469            echo '<div class="post2podcast-tier-header">';
     
    504505        echo '</div>'; // .post2podcast-options-container
    505506
    506         // Show warning if free credits are exhausted
    507         if (!$is_current_pro && $free_credits_available <= 0) {
     507        // Show warning if free credits are exhausted (but not if self-hosted is configured)
     508        if (!$is_current_pro && !$is_self_hosted_configured && $free_credits_available <= 0) {
    508509            echo '<div class="notice notice-info" style="margin: 15px 0;">';
    509510            echo '<p>' . esc_html__('You\'ve used all your free generations. Upgrade to PRO for 300 monthly credits.', 'post2podcast') . '</p>';
     
    15351536            );
    15361537        }
    1537        
     1538
     1539        // Check if self-hosted is configured (unlimited credits for whitelisted sites)
     1540        $options = get_option('post2podcast_options');
     1541        $self_hosted_api_key = isset($options['openai_api_key']) ? $options['openai_api_key'] : '';
     1542        $self_hosted_server_url = isset($options['api_base_url']) ? $options['api_base_url'] : '';
     1543        $self_hosted_enabled = isset($options['self_hosted_enabled']) && $options['self_hosted_enabled'];
     1544        $is_self_hosted_configured = $this->is_whitelisted && $self_hosted_enabled && !empty($self_hosted_api_key) && !empty($self_hosted_server_url);
     1545
     1546        if ($is_self_hosted_configured) {
     1547            return array(
     1548                'can_generate' => true,
     1549                'message' => '',
     1550                'credits_remaining' => PHP_INT_MAX // Unlimited
     1551            );
     1552        }
     1553
    15381554        $subscription_status = get_user_meta($user_id, '_post2podcast_subscription_status', true);
    1539         $user_id = get_current_user_id();
    15401555        $current_period_end = get_user_meta($user_id, '_post2podcast_current_period_end', true);
    15411556        $credits_remaining = get_user_meta($user_id, '_post2podcast_credits_remaining', true);
    15421557        $free_credits_used = get_user_meta($user_id, '_post2podcast_free_credits_used', true);
    1543        
     1558
    15441559        if ($free_credits_used === '') $free_credits_used = 0;
    15451560        if ($credits_remaining === '') $credits_remaining = 0;
  • post2podcast/trunk/post2podcast.php

    r3432101 r3432112  
    44 * Plugin server URI: https://github.com/samukbg/post2podcast-server
    55 * Description: Convert WordPress posts into podcast episodes with AI voices
    6  * Version: 1.1.7
     6 * Version: 1.1.8
    77 * Author: Samuel Bezerra
    88 * Author URI: https://github.com/samukbg
     
    2020
    2121// Define plugin constants
    22 define('POST2PODCAST_VERSION', '1.1.7');
     22define('POST2PODCAST_VERSION', '1.1.8');
    2323define('POST2PODCAST_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2424define('POST2PODCAST_PLUGIN_URL', plugin_dir_url(__FILE__));
  • post2podcast/trunk/readme.txt

    r3432101 r3432112  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.1.7
     7Stable tag: 1.1.8
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    273273
    274274== Changelog ==
     275= 1.1.8 =
     276* FIXED: Tier activation logic for improved subscription handling
     277* FIXED: Automatic and bulk generation feature availability
     278* IMPROVED: Credit checking system for better user experience
     279
    275280= 1.1.7 =
    276281* FIXED: Configuration detection in settings page
Note: See TracChangeset for help on using the changeset viewer.