Skip to content

fix: remove pricing display for free plan in staging UI#444

Open
vikasiwp wants to merge 3 commits into
developfrom
fix/docker-networking-and-docs
Open

fix: remove pricing display for free plan in staging UI#444
vikasiwp wants to merge 3 commits into
developfrom
fix/docker-networking-and-docs

Conversation

@vikasiwp
Copy link
Copy Markdown
Contributor

@vikasiwp vikasiwp commented Dec 9, 2025

Summary

  • Remove $0.00/mo pricing display for free plan in staging site creation UI
  • Only paid plans now show pricing ($X/mo - $Y/day)

Changes

  • migrate/templates/ajax/part-site-plans.php - Removed pricing for free plan

Test Plan

  • Free plan shows without any pricing text
  • Paid plans still show $X/mo - $Y/day format

🤖 Generated with Claude Code

vikasiwp and others added 3 commits December 4, 2025 16:24
- Fix iwp_get_wp_root_directory() to work with symlinked plugins
- Use multiple starting paths including DOCUMENT_ROOT + REQUEST_URI
- Add local dev URL detection in InstaWP_Tools

CRITICAL FIX: Migrations from symlinked plugin directories (/mnt/plugin-dev/)
failed because __DIR__ resolves symlinks, breaking wp-config.php traversal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Free plan no longer shows "$0.00/mo" - only paid plans display pricing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Dec 9, 2025

Claude finished @vikasiwp's task —— View job


PR Code Review ✅

Reviewing this pull request that removes pricing display for free plans in the staging UI.

Todo List:

  • Read repository guidelines (CLAUDE.md) - No repo-specific guidelines found
  • Examine changed files for code quality
  • Analyze the main change in part-site-plans.php
  • Review additional changes in class-instawp-tools.php
  • Review additional changes in functions-pull-push.php
  • Check for potential bugs and security concerns
  • Evaluate test coverage needs
  • Provide final recommendations

📋 Code Review Findings

Main Feature Implementation (migrate/templates/ajax/part-site-plans.php:65-67)

The core change successfully addresses the PR requirements:

  • Before: if ( $is_free_plan ) displayed $0.00/mo for free plans
  • After: if ( ! $is_free_plan ) only shows pricing for paid plans in $X/mo - $Y/day format
  • Security: Proper use of esc_html() for output sanitization ✅
  • Logic: Clean conditional that correctly inverts the display logic ✅

🔧 Additional Changes Analysis

includes/class-instawp-tools.php:

  1. User-Agent Consistency (lines 769, 1238):

    • Good: Adds consistent user-agent headers using Helper::getInstaWPUserAgent()
    • Security: Improves request identification and reduces anonymous requests
  2. Directory Protection Logic (lines 214, 228):

    • Security Enhancement: Adds exception for iwp- prefixed plugins before applying protection
    • ⚠️ Potential Issue: Complex boolean logic - consider extracting to helper method for readability
  3. Cleanup Improvements (lines 2229-2230):

    • Maintenance: Adds cleanup for iwp-demo-helper-* and iwp-migration-helper-* plugins
    • Pattern: Follows existing glob pattern conventions

includes/functions-pull-push.php:

  • Robust Enhancement: Improves WordPress root detection for symlinked installations
  • Documentation: Well-documented with comprehensive PHPDoc comments
  • Backward Compatibility: Maintains existing function signature while improving reliability

🧪 Test Coverage Recommendations

  1. UI Tests: Verify free plans show no pricing text
  2. Integration Tests: Confirm paid plans still display both monthly/daily rates
  3. Edge Cases: Test with malformed rate data in plan configurations
  4. Directory Protection: Test the new iwp- plugin exception logic

🚨 Security & Performance Assessment

  • No security vulnerabilities identified
  • Proper input sanitization maintained
  • No performance impact expected
  • No sensitive data exposure

📝 Minor Recommendations

  1. Code Readability: Consider extracting the complex boolean logic in class-instawp-tools.php:214-228 to a helper method
  2. Testing: Add unit tests for the directory protection exception logic
  3. Documentation: Consider adding inline comments explaining the iwp- plugin exception rationale

Final Verdict

APPROVED - This PR successfully implements the requested feature with clean code, proper security practices, and valuable additional improvements. The changes are well-structured and maintain backward compatibility while enhancing functionality.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant