-
Notifications
You must be signed in to change notification settings - Fork 154
fix/tec-draft-events-dashboard-visibility #1772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix/tec-draft-events-dashboard-visibility #1772
Conversation
WalkthroughRemoved 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
📒 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: Thetribe_suppress_query_filtersparameter is valid and properly implemented—no changes required.The
tribe_suppress_query_filtersparameter is a documented TEC mechanism that causes bothparse_query()andpre_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 theparse_queryandpre_get_postsstages. 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.
There was a problem hiding this 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
<?phptag 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 forpost_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 fromis_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_statusvalues are not validated. WhileWP_Querymay 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
📒 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_statusarray is correctly used in theWP_Queryarguments, enabling the configurable post_status feature.


CLose 1333 , Related PRO PR
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.