Skip to content

Conversation

@arifulhoque7
Copy link
Contributor

@arifulhoque7 arifulhoque7 commented Dec 18, 2025

CLose 1333 , Related PRO PR

Summary by CodeRabbit

  • New Features
    • Dashboard shortcode now accepts and respects a post_status attribute (comma-separated or array) for listings.
  • Bug Fixes
    • Fixed dashboard listing so posts with specified statuses (draft, future, pending, publish, private) appear correctly.

✏️ Tip: You can customize this high-level summary in your review settings.

@arifulhoque7 arifulhoque7 requested a review from sapayth December 18, 2025 10:19
@arifulhoque7 arifulhoque7 self-assigned this Dec 18, 2025
@arifulhoque7 arifulhoque7 added needs: testing needs: dev review This PR needs review by a developer labels Dec 18, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

Removed Tribe Events integration hooks and added dynamic post_status parsing and handling to the frontend dashboard post listing shortcode; constructor and Tribe-related method were deleted, and shortcode attributes now include a configurable post_status default.

Changes

Cohort / File(s) Summary
Frontend dashboard post listing updates
includes/Frontend/Frontend_Dashboard.php
Removed the class constructor and remove_tribe_pre_get_posts() method that hooked Tribe Events filters. Added a post_status shortcode attribute with default 'draft,future,pending,publish,private'. In post_listing, parse and normalize post_status (accepting string or array), remove it from attributes, and use the computed $post_status in the WP_Query args. Minor surrounding scaffolding adjustments to support the new parsing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Single-file change with multiple behavioral edits (hook removal + new shortcode attribute parsing).
  • Review focus:
    • Ensure removal of constructor and hook won't break initialization or other integrations.
    • Verify post_status parsing handles edge cases (empty values, arrays, whitespace).
    • Confirm WP_Query receives the expected array format and that no other callers expect the removed methods.

Suggested labels

Dev Review Done

Suggested reviewers

  • sapayth

Poem

🐰 I nudged the hooks and trimmed a line or two,
Now statuses dance in a clearer view,
Drafts and futures march in a tidy array,
The dashboard hums softly throughout the day. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references TEC (Tribe Events Calendar) and draft events dashboard visibility, which directly aligns with the changes that remove Tribe Events integration and add dynamic post_status handling for dashboard listing.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
includes/Frontend/Frontend_Dashboard.php (1)

21-21: Fix typo in comment.

"reequired" should be "required".

🔎 Apply this diff to fix the typo:
-     * that's why this function is reequired.
+     * that's why this function is required.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34f2b63 and 15fce51.

📒 Files selected for processing (1)
  • includes/Frontend/Frontend_Dashboard.php (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Inspections
includes/Frontend/Frontend_Dashboard.php

[error] 1-1: Opening PHP tag must be on a line by itself

🔇 Additional comments (1)
includes/Frontend/Frontend_Dashboard.php (1)

93-98: The tribe_suppress_query_filters parameter is valid and properly implemented—no changes required.

The tribe_suppress_query_filters parameter is a documented TEC mechanism that causes both parse_query() and pre_get_posts() to return early and skip all TEC query filtering. TEC's own Event Repository class uses this by default. This approach is actually more comprehensive than removing a single hook, as it prevents TEC filtering at both the parse_query and pre_get_posts stages. No conflicts or redundancy issues exist with any existing TEC handling mechanism.

Removed legacy Events Calendar code and added the ability to specify post_status via the dashboard shortcode attribute. The post_status parameter is now parsed from shortcode attributes, allowing more flexible filtering of posts displayed on the frontend dashboard.
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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
includes/Frontend/Frontend_Dashboard.php (1)

1-2: Fix the PHP opening tag formatting to resolve pipeline failure.

The pipeline is failing with "Opening PHP tag must be on a line by itself." Ensure that the <?php tag on line 1 is the only content on that line with no trailing whitespace or characters.

🧹 Nitpick comments (3)
includes/Frontend/Frontend_Dashboard.php (3)

78-78: Simplify: The ternary operator is redundant.

Since shortcode_atts() on line 36 already sets a default value for post_status, the $attributes['post_status'] key will always exist. You can directly use $attributes['post_status'].

🔎 Apply this diff to simplify the logic:
-$post_status = $attributes['post_status'] ? $attributes['post_status'] : 'draft,future,pending,publish,private';
+$post_status = $attributes['post_status'];

79-79: Remove unnecessary leading backslash from is_array().

The leading backslash before is_array() is unnecessary. Since this is a native PHP function, it can be called without the global namespace prefix.

🔎 Apply this diff:
-$post_status = \is_array( $post_status ) ? $post_status : explode( ',', $post_status );
+$post_status = is_array( $post_status ) ? $post_status : explode( ',', $post_status );

78-81: Consider validating post_status values against allowed WordPress statuses.

The parsed $post_status values are not validated. While WP_Query may handle invalid values gracefully, explicitly validating against WordPress's registered post statuses would prevent potential issues and make the code more robust.

🔎 Consider adding validation like this:
// Parse post_status from shortcode attribute
$post_status = $attributes['post_status'];
$post_status = is_array( $post_status ) ? $post_status : explode( ',', $post_status );
$post_status = array_map( 'trim', $post_status );

// Validate against registered post statuses
$valid_statuses = get_post_stati();
$post_status = array_filter( $post_status, function( $status ) use ( $valid_statuses ) {
    return isset( $valid_statuses[ $status ] );
} );

// Fallback to default if no valid statuses
if ( empty( $post_status ) ) {
    $post_status = [ 'draft', 'future', 'pending', 'publish', 'private' ];
}

unset( $attributes['post_status'] );
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15fce51 and 85abbf2.

📒 Files selected for processing (1)
  • includes/Frontend/Frontend_Dashboard.php (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
includes/Frontend/Frontend_Dashboard.php (1)
wpuf-functions.php (1)
  • wpuf_get_option (1543-1551)
🪛 GitHub Actions: Inspections
includes/Frontend/Frontend_Dashboard.php

[error] 1-1: Command failed: vendor/bin/phpcs includes/Frontend/Frontend_Dashboard.php -q --report=checkstyle | cs2pr --graceful-warnings. Error: Opening PHP tag must be on a line by itself.

🔇 Additional comments (2)
includes/Frontend/Frontend_Dashboard.php (2)

36-36: LGTM! Good addition of configurable post_status.

The default value includes all relevant post statuses for a user dashboard, making the shortcode more flexible.


85-85: LGTM! Dynamic post_status correctly integrated.

The parsed $post_status array is correctly used in the WP_Query arguments, enabling the configurable post_status feature.

@Rubaiyat-E-Mohammad
Copy link
Contributor

Rubaiyat-E-Mohammad commented Jan 6, 2026

  • Drafted events through clicking the button "Save as Draft" are still not showing in the frontend.
image image

@Rubaiyat-E-Mohammad Rubaiyat-E-Mohammad added bug QA Approved This PR is approved by the QA team and removed needs: testing bug labels Jan 6, 2026
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 QA Approved This PR is approved by the QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants