Skip to content

Add guest & paid guest post templates and assets#1818

Open
arifulhoque7 wants to merge 3 commits intoweDevsOfficial:developfrom
arifulhoque7:feature/add-paid-guest-post-form-templates
Open

Add guest & paid guest post templates and assets#1818
arifulhoque7 wants to merge 3 commits intoweDevsOfficial:developfrom
arifulhoque7:feature/add-paid-guest-post-form-templates

Conversation

@arifulhoque7
Copy link
Contributor

@arifulhoque7 arifulhoque7 commented Feb 23, 2026

Summary

  • Add Post_Form_Template_Paid_Guest_Post — free template for one-time paid guest submissions (mandatory subscription, fallback PPP disabled, guest post permission with name/email/email-verify, post status: draft)
  • Add Post_Form_Template_Guest_Post_Recurring — free template for recurring subscription guest submissions (mandatory subscription, fallback pay-per-post ON when limit exceeds, comment status open)
  • Add SVG thumbnails for both templates matching existing visual style
  • Register both templates in wpuf_get_post_form_templates() and $template_options
  • Add Pro_Form_Preview_Testimonial stub + register in Free_Loader for Pro badge preview

Fields (both templates)

Post Title → Post Content → Post Excerpt → Featured Image → Category → Tags

Test plan

  • Both templates appear in "Add New Form" modal
  • Creating form from each template produces correct fields and settings
  • Payment: Enable Payment ON, Mandatory Subscription selected
  • Paid Guest Post: Pay-per-post when limit exceeds → OFF
  • Recurring template: Pay-per-post when limit exceeds → ON (checked)
  • Guest post permission with name/email collection and email verification
  • Post status defaults to Draft
  • New post & update post email notifications both ON

Close 882
Close 884

Summary by CodeRabbit

  • New Features

    • Added "Paid Guest Post" form template for monetizing guest submissions.
    • Added "Guest Post (Recurring Subscription)" form template requiring recurring subscription.
    • Added "Testimonial Submission" form template preview.
  • Enhancements

    • New templates include configurable fields, notification settings, payment options, labels, and access/visibility controls.

Introduce two new post form templates: Paid Guest Post (one-time payment) and Guest Post (Recurring Subscription) along with their SVG preview images. Add a Pro preview class for a Testimonial template and its SVG, and register the testimonial preview in Free_Loader. Register the new post templates in wpuf_get_post_form_templates and add corresponding entries to the form builder menu. Templates collect title, content, excerpt, featured image, category and tags and configure payment/notification settings.
@arifulhoque7 arifulhoque7 requested a review from sapayth February 23, 2026 04:56
@arifulhoque7 arifulhoque7 self-assigned this Feb 23, 2026
@arifulhoque7 arifulhoque7 added needs: dev review This PR needs review by a developer needs: testing labels Feb 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Warning

Rate limit exceeded

@arifulhoque7 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d2b45f92-5798-4aee-8f5f-47db11b5c531

📥 Commits

Reviewing files that changed from the base of the PR and between 18efe0d and 9a09fc3.

📒 Files selected for processing (3)
  • includes/Admin/Forms/Post/Templates/Post_Form_Template_Paid_Guest_Post.php
  • includes/Free/Free_Loader.php
  • wpuf-functions.php

Walkthrough

Adds two new guest post form templates (paid and recurring subscription) and a testimonial pro preview template; registers the preview in the loader and exposes the new templates in the post form template registry and builder menu.

Changes

Cohort / File(s) Summary
New Post Form Templates
includes/Admin/Forms/Post/Templates/Post_Form_Template_Paid_Guest_Post.php, includes/Admin/Forms/Post/Templates/Post_Form_Template_Guest_Post_Recurring.php
Added two new form template classes defining form fields (post_title, post_content, post_excerpt, featured_image, category, tags) and extensive form_settings covering post type/status, guest posting options, notifications, and payment configurations (force_pack_purchase, pay-per-post, recurring controls).
New Form Preview Template
includes/Admin/Forms/Post/Templates/Pro_Form_Preview_Testimonial.php
Added Pro_Form_Preview_Testimonial with title, image, and pro_icon properties and getter methods for preview metadata.
Template Registry & Loader Updates
includes/Free/Free_Loader.php, wpuf-functions.php
Registered the testimonial pro preview in the loader and added post_form_template_paid_guest_post and post_form_template_guest_post_recurring entries to the post form templates registry and builder setting menu options.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • sapayth

Poem

🐰 I hopped a patch into the nest,
Paid and recurring guest posts dressed,
A testimonial sparkle, tiny and neat,
Registry updated — a carrot treat! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding two new guest post form templates (paid and recurring) and their associated preview assets.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
includes/Admin/Forms/Post/Templates/Post_Form_Template_Guest_Post_Recurring.php (1)

14-211: Consider extracting shared field/settings definitions to avoid near-total duplication with Post_Form_Template_Paid_Guest_Post.

The entire $this->form_fields array (all six fields) and roughly 90 % of $this->form_settings are copied verbatim between the two new templates. Only five keys differ (comment_status, form_description, fallback_ppp_enable, form_template, and notification.new_subject). Maintaining these in sync will be fragile.

A lightweight fix is a shared base class:

♻️ Suggested refactor
// New file: Post_Form_Template_Guest_Post_Base.php
abstract class Post_Form_Template_Guest_Post_Base extends Form_Template {

    public function __construct() {
        parent::__construct();
        $this->enabled = true;

        $this->form_fields = [
            // ... the six shared fields ...
        ];
    }

    protected function base_form_settings(): array {
        return [
            'post_type'             => 'post',
            'post_status'           => 'draft',
            'default_cat'           => '-1',
            'post_permission'       => 'guest_post',
            'guest_post'            => 'true',
            'guest_details'         => 'on',
            'name_label'            => 'Name',
            'email_label'           => 'E-Mail',
            'guest_email_verify'    => 'on',
            // ... all shared keys ...
        ];
    }
}

// Post_Form_Template_Guest_Post_Recurring
class Post_Form_Template_Guest_Post_Recurring extends Post_Form_Template_Guest_Post_Base {
    public function __construct() {
        parent::__construct();
        $this->title       = __( 'Guest Post (Recurring Subscription)', 'wp-user-frontend' );
        $this->description = __( '...', 'wp-user-frontend' );
        $this->image       = WPUF_ASSET_URI . '/images/templates/guest-post-recurring.svg';

        $this->form_settings = array_merge(
            $this->base_form_settings(),
            [
                'comment_status'    => 'open',
                'fallback_ppp_enable' => 'on',
                'form_template'     => 'post_form_template_guest_post_recurring',
                'form_description'  => __( '...recurring...', 'wp-user-frontend' ),
                'notification'      => [ /* recurring notification */ ],
            ]
        );
    }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@includes/Admin/Forms/Post/Templates/Post_Form_Template_Guest_Post_Recurring.php`
around lines 14 - 211, The two templates
(Post_Form_Template_Guest_Post_Recurring and Post_Form_Template_Paid_Guest_Post)
duplicate the same $this->form_fields and most of $this->form_settings; extract
the shared data into a new base class (e.g., Post_Form_Template_Guest_Post_Base)
by moving the six shared field definitions into the base constructor as
$this->form_fields and exposing a protected base_form_settings() that returns
the shared settings array, then in each child
(Post_Form_Template_Guest_Post_Recurring) call parent::__construct() and set
title/description/image and set $this->form_settings =
array_merge($this->base_form_settings(), [/* only the five differing keys:
comment_status, form_description, fallback_ppp_enable, form_template,
notification.new_subject */]); ensure symbol names match the existing classes
and preserve gettext calls and notification structure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@includes/Admin/Forms/Post/Templates/Post_Form_Template_Paid_Guest_Post.php`:
- Line 155: Update the Paid Guest Post template's 'form_description' to mention
the excerpt field so it matches the fields declared in 'form_fields'
(specifically the 'post_excerpt' field); locate the 'form_description' entry in
Post_Form_Template_Paid_Guest_Post.php and edit the string to include "excerpt"
(e.g., add "excerpt" or "post excerpt" alongside title, content, tags, and
featured image) so submitters see the same fields that are actually submitted.

In `@wpuf-functions.php`:
- Around line 5206-5207: The labels for the paid guest-post template are
inconsistent: update the $template_options entry keyed by
'post_form_template_paid_guest_post' in wpuf-functions.php so its translation
string matches Post_Form_Template_Paid_Guest_Post::$title (use "Paid Guest
Post"), ensuring both the Add New Form modal and the form-builder dropdown show
the same label; edit the __('Paid Guest Post Form', 'wp-user-frontend') call to
__('Paid Guest Post', 'wp-user-frontend') so the strings align.

---

Nitpick comments:
In
`@includes/Admin/Forms/Post/Templates/Post_Form_Template_Guest_Post_Recurring.php`:
- Around line 14-211: The two templates (Post_Form_Template_Guest_Post_Recurring
and Post_Form_Template_Paid_Guest_Post) duplicate the same $this->form_fields
and most of $this->form_settings; extract the shared data into a new base class
(e.g., Post_Form_Template_Guest_Post_Base) by moving the six shared field
definitions into the base constructor as $this->form_fields and exposing a
protected base_form_settings() that returns the shared settings array, then in
each child (Post_Form_Template_Guest_Post_Recurring) call parent::__construct()
and set title/description/image and set $this->form_settings =
array_merge($this->base_form_settings(), [/* only the five differing keys:
comment_status, form_description, fallback_ppp_enable, form_template,
notification.new_subject */]); ensure symbol names match the existing classes
and preserve gettext calls and notification structure.

arifulhoque7 and others added 2 commits March 6, 2026 14:19
Include 'excerpt' in the Paid Guest Post form description, enable pay-per-post by default with a default cost of 5, and switch default payment option flags (disable forced pack purchase). Update the admin menu label to 'Paid Guest Post' (remove 'Form' suffix). Also apply minor formatting/spacing fixes in Free_Loader (HTML/pro-badge strings and long string concatenation) and a small code formatting tweak for the post form template instantiation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: dev review This PR needs review by a developer needs: testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant