Skip to content

Add guest & paid guest post templates and assets#1818

Open
arifulhoque7 wants to merge 5 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 5 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" and "Guest Post (Recurring Subscription)" form templates.
    • Added "Testimonial Submission" template preview.
  • Enhancements

    • New templates provide configurable post fields, guest-flow labels, visibility controls, notification templates, and payment settings (one‑time and recurring).
    • Post form builder settings updated to include the new template options.

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

Walkthrough

Adds two new post form templates (paid guest post and guest post with recurring subscription), a pro testimonial preview template, and registers the new preview and templates in the loader and post-form template registry/menu.

Changes

Cohort / File(s) Summary
New Paid Guest Post Template
includes/Admin/Forms/Post/Templates/Post_Form_Template_Paid_Guest_Post.php
Adds Post_Form_Template_Paid_Guest_Post class with form_fields (title, content, excerpt, featured_image, category, tags) and comprehensive form_settings including guest workflow, payment options (force pack, pay-per-post, cost), notifications for new/edited submissions.
New Recurring Guest Post Template
includes/Admin/Forms/Post/Templates/Post_Form_Template_Guest_Post_Recurring.php
Adds Post_Form_Template_Guest_Post_Recurring class similarly defining fields and form_settings focused on guest posting tied to recurring payments, including notifications and payment toggles.
New Pro Preview Template
includes/Admin/Forms/Post/Templates/Pro_Form_Preview_Testimonial.php
Adds Pro_Form_Preview_Testimonial with title, image, pro_icon properties and getters for preview metadata.
Loader & Registry Updates
includes/Free/Free_Loader.php, wpuf-functions.php
Imports and registers the new testimonial preview in pro_form_previews; adds post_form_template_paid_guest_post and post_form_template_guest_post_recurring entries to the post form templates registry and builder setting menu. Minor formatting/spacing adjustments in loader.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

needs: dev review

Suggested reviewers

  • sapayth

Poem

🐰 I hopped a patch into the wood,
Two guest-post forms now look so good,
A crown for testimonials near,
Registry whispers, "All is clear",
I nibbled code and danced with cheer.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% 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 pull request title 'Add guest & paid guest post templates and assets' accurately describes the main changes, which involve adding two new post form templates (Paid Guest Post and Guest Post Recurring) along with their SVG assets and registering them in the codebase.

✏️ 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
📝 Coding Plan
  • Generate coding plan for human review comments

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.
Copy link
Member

@sapayth sapayth left a comment

Choose a reason for hiding this comment

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

  1. Duplicate Pro_Form_Preview_Artwork registration (Free_Loader.php)

The diff adds a new aligned line for Artwork but doesn't remove the old one, resulting in Artwork being registered twice:

  // Line added by this PR:
  $integrations['WPUF_Pro_Form_Preview_Artwork']            = new Pro_Form_Preview_Artwork();
  $integrations['WPUF_Pro_Form_Preview_Testimonial']        = new Pro_Form_Preview_Testimonial();
  // Original line still present:
  $integrations['WPUF_Pro_Form_Preview_Artwork'] = new Pro_Form_Preview_Artwork();

This instantiates Pro_Form_Preview_Artwork twice. The second overwrites the first so it won't break at runtime, but it's clearly a merge/rebase mistake and should be cleaned up.

  1. Hardcoded @SInCE 4.2.2 instead of WPUF_SINCE placeholder

Both new template classes use @SInCE 4.2.2 in docblocks. Per project convention, this should be @SInCE WPUF_SINCE so it gets replaced with the actual version at release time.

Medium Issues

  1. Non-translatable labels in form_settings

Both templates have hardcoded strings that should be wrapped in __():

  'name_label'  => 'Name',        // Should be __( 'Name', 'wp-user-frontend' )
  'email_label' => 'E-Mail',      // Should be __( 'E-Mail', 'wp-user-frontend' )
  1. Pro_Form_Preview_Testimonial missing @SInCE docblock

The class-level docblock has no @SInCE tag. The other two new classes have @SInCE — this one should too (as WPUF_SINCE). Also, individual method docblocks are missing @SInCE tags.

  1. Inconsistent alignment in wpuf-functions.php

The new entries use different column alignment from surrounding lines:

$integrations['post_form_template_post'] = new ... // spaces to col ~52
$integrations['post_form_template_video'] = new ... // spaces to col ~52
$integrations['post_form_template_paid_guest_post'] = new ... // spaces to col ~57
$integrations['post_form_template_guest_post_recurring'] = new ... // spaces to col ~57

Same issue in wpuf_get_post_form_builder_setting_menu_contents(). The alignment should be consistent within each block.

@sapayth sapayth added needs: author reply This PR needs author feedback or code changes and removed needs: dev review This PR needs review by a developer labels Mar 16, 2026
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.

🧹 Nitpick comments (1)
includes/Free/Free_Loader.php (1)

1029-1035: Remove duplicate WPUF_Pro_Form_Preview_Artwork registration.

Line 1034 reassigns the same key already set on Line 1032. It currently has no runtime effect, but it’s noisy and error-prone for future edits.

Proposed cleanup
     $integrations['WPUF_Pro_Form_Preview_EDD']                = new Pro_Form_Preview_EDD();
     $integrations['WPUF_Pro_Form_Preview_Press_Release']      = new Pro_Form_Preview_Press_Release();
     $integrations['WPUF_Pro_Form_Preview_Professional_Video'] = new Pro_Form_Preview_Professional_Video();
     $integrations['WPUF_Pro_Form_Preview_Artwork']            = new Pro_Form_Preview_Artwork();
     $integrations['WPUF_Pro_Form_Preview_Testimonial']        = new Pro_Form_Preview_Testimonial();
-    $integrations['WPUF_Pro_Form_Preview_Artwork'] = new Pro_Form_Preview_Artwork();
     $integrations['WPUF_Pro_Form_Preview_Portfolio'] = new Pro_Form_Preview_Portfolio();
     $integrations['WPUF_Pro_Form_Preview_Volunteer'] = new Pro_Form_Preview_Volunteer();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@includes/Free/Free_Loader.php` around lines 1029 - 1035, The integrations
array is registering WPUF_Pro_Form_Preview_Artwork twice (the key/class
WPUF_Pro_Form_Preview_Artwork appears on both the Pro_Form_Preview_Artwork
lines); remove the duplicate assignment so the integrations array only
instantiates new Pro_Form_Preview_Artwork() once (leave the other registrations
like WPUF_Pro_Form_Preview_Portfolio intact) to eliminate the redundant noisy
re-assignment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@includes/Free/Free_Loader.php`:
- Around line 1029-1035: The integrations array is registering
WPUF_Pro_Form_Preview_Artwork twice (the key/class WPUF_Pro_Form_Preview_Artwork
appears on both the Pro_Form_Preview_Artwork lines); remove the duplicate
assignment so the integrations array only instantiates new
Pro_Form_Preview_Artwork() once (leave the other registrations like
WPUF_Pro_Form_Preview_Portfolio intact) to eliminate the redundant noisy
re-assignment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3dd814f-51fd-4dfc-af73-41d913ca2cde

📥 Commits

Reviewing files that changed from the base of the PR and between 18efe0d and 651d774.

📒 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
🚧 Files skipped from review as they are similar to previous changes (2)
  • includes/Admin/Forms/Post/Templates/Post_Form_Template_Paid_Guest_Post.php
  • wpuf-functions.php

Wrap guest name/email labels in translation calls and replace hardcoded @SInCE values with WPUF_SINCE in several post form templates. Add @SInCE annotations to Pro_Form_Preview_Testimonial class/methods. Remove a duplicate Pro form preview integration in Free_Loader and apply minor spacing/formatting cleanups in wpuf-functions.php.
@arifulhoque7
Copy link
Contributor Author

All 5 issues fixed @sapayth vai. Here's a summary:

  1. Duplicate Pro_Form_Preview_Artwork (Free_Loader.php) — removed the duplicate line 1034, and fixed alignment of Portfolio and Volunteer entries to match the block.

  2. @SInCE 4.2.2 → @SInCE WPUF_SINCE — updated both Post_Form_Template_Paid_Guest_Post.php and Post_Form_Template_Guest_Post_Recurring.php.

  3. Non-translatable labels — wrapped 'Name' and 'E-Mail' in __() in both template files.

  4. Pro_Form_Preview_Testimonial missing @SInCE — added @SInCE WPUF_SINCE to the class docblock and all three method docblocks (get_title, get_image, get_pro_icon).

  5. Inconsistent alignment — re-aligned all entries in wpuf_get_post_form_templates() and the $template_options array in wpuf_get_post_form_builder_setting_menu_contents() to a consistent column throughout each block.

@arifulhoque7 arifulhoque7 added needs: dev review This PR needs review by a developer and removed needs: author reply This PR needs author feedback or code changes labels Mar 16, 2026
@arifulhoque7 arifulhoque7 requested a review from sapayth March 16, 2026 07:34
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: 1

🤖 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_Guest_Post_Recurring.php`:
- Around line 174-179: The 'fallback_ppp_enable' value in the template is using
the string 'on' which breaks style consistency; change the array entry for
'fallback_ppp_enable' to use the string 'true' (match the sibling
Post_Form_Template_Paid_Guest_Post.php and the form UI expectations) so the
configuration keys (e.g., 'payment_options', 'force_pack_purchase',
'fallback_ppp_enable') all use the same 'true'/'false' string format.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3fad4953-7a75-4525-808c-ba03104f9f97

📥 Commits

Reviewing files that changed from the base of the PR and between 651d774 and 2ac8d13.

📒 Files selected for processing (5)
  • includes/Admin/Forms/Post/Templates/Post_Form_Template_Guest_Post_Recurring.php
  • includes/Admin/Forms/Post/Templates/Post_Form_Template_Paid_Guest_Post.php
  • includes/Admin/Forms/Post/Templates/Pro_Form_Preview_Testimonial.php
  • includes/Free/Free_Loader.php
  • wpuf-functions.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • wpuf-functions.php
  • includes/Admin/Forms/Post/Templates/Pro_Form_Preview_Testimonial.php

Comment on lines +174 to +179
'payment_options' => 'true',
'choose_payment_option' => 'force_pack_purchase',
'force_pack_purchase' => 'true',
'enable_pay_per_post' => 'false',
'fallback_ppp_enable' => 'on',
'use_theme_css' => 'wpuf-style',
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check how fallback_ppp_enable is evaluated in the codebase to verify which format is expected

# Search for fallback_ppp_enable usage patterns
rg -nC3 'fallback_ppp_enable' --type=php

# Check if wpuf_is_checkbox_or_toggle_on is used for this setting
rg -nP 'fallback_ppp_enable.*wpuf_is_checkbox|wpuf_is_checkbox.*fallback_ppp' --type=php

Repository: weDevsOfficial/wp-user-frontend

Length of output: 8946


🏁 Script executed:

# Find the definition of wpuf_is_checkbox_or_toggle_on function
rg -n 'function\s+wpuf_is_checkbox_or_toggle_on' --type=php -A 10

Repository: weDevsOfficial/wp-user-frontend

Length of output: 625


Remove the claim about potential evaluation issues; this is a style consistency fix only.

The fallback_ppp_enable setting in this template uses 'on' while the sibling template (Post_Form_Template_Paid_Guest_Post.php) and the HTML form UI (which expects 'true') use the 'true'/'false' string format. While wpuf_is_checkbox_or_toggle_on() does handle 'on' correctly, aligning this to 'true' ensures consistent formatting across templates.

🔧 Suggested fix for consistency
             'payment_options'       => 'true',
             'choose_payment_option' => 'force_pack_purchase',
             'force_pack_purchase'   => 'true',
             'enable_pay_per_post'   => 'false',
-            'fallback_ppp_enable'   => 'on',
+            'fallback_ppp_enable'   => 'true',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'payment_options' => 'true',
'choose_payment_option' => 'force_pack_purchase',
'force_pack_purchase' => 'true',
'enable_pay_per_post' => 'false',
'fallback_ppp_enable' => 'on',
'use_theme_css' => 'wpuf-style',
'payment_options' => 'true',
'choose_payment_option' => 'force_pack_purchase',
'force_pack_purchase' => 'true',
'enable_pay_per_post' => 'false',
'fallback_ppp_enable' => 'true',
'use_theme_css' => 'wpuf-style',
🤖 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 174 - 179, The 'fallback_ppp_enable' value in the template is using
the string 'on' which breaks style consistency; change the array entry for
'fallback_ppp_enable' to use the string 'true' (match the sibling
Post_Form_Template_Paid_Guest_Post.php and the form UI expectations) so the
configuration keys (e.g., 'payment_options', 'force_pack_purchase',
'fallback_ppp_enable') all use the same 'true'/'false' string format.

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.

2 participants