fix: format wording of plugin update notice#1794
fix: format wording of plugin update notice#1794sapayth wants to merge 1 commit intoweDevsOfficial:developfrom
Conversation
WalkthroughThe change corrects improper argument passing to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@wpuf.php`:
- Around line 263-269: Remove the trailing whitespace on the sprintf block lines
and add a translators comment immediately above the __() call to explain the two
HTML placeholder arguments (e.g., // translators: %1$s opening anchor tag for
free/pro link, %2$s closing anchor tag), and update the anchor href used in the
sprintf placeholders so the anchor wrapping "WP User Frontend Pro" points to the
Pro product URL instead of the free plugin URL; keep the current call structure
using sprintf(...) passed into wp_kses_post(...) and ensure no extra spaces
remain.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
wpuf.php
🧰 Additional context used
🪛 GitHub Actions: Inspections
wpuf.php
[warning] 1-1: PHPCS: This comment is 43% valid code; is this commented out code?
[error] 1-1: PHPCS: Whitespace found at end of line.
🪛 GitHub Check: Run PHPCS inspection
wpuf.php
[failure] 265-265:
A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
[failure] 264-264:
Whitespace found at end of line
[failure] 263-263:
Whitespace found at end of line
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| echo wp_kses_post( | ||
| sprintf( | ||
| __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ), | ||
| '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">', | ||
| '</a>' | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Core fix is correct — sprintf() now properly wraps the translation.
The restructuring correctly ensures sprintf() processes the placeholders before the result is passed to wp_kses_post(). This resolves the original issue.
However, there are a few items to address:
-
Trailing whitespace (lines 263-264): PHPCS is failing due to trailing whitespace.
-
Missing translators comment: WordPress coding standards require a
// translators:comment above__()calls containing placeholders to help translators understand their meaning. -
Link URL mismatch: The anchor wraps "WP User Frontend Pro" but links to
wordpress.org/plugins/wp-user-frontend/which is the free plugin page. Should this link to the Pro product page (e.g.,wedevs.com/wp-user-frontend-pro/) instead?
Proposed fix addressing whitespace and translators comment
<?php
- echo wp_kses_post(
- sprintf(
- __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
- '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">',
+ // translators: %1$s and %2$s are opening and closing anchor tags for the WP User Frontend Pro link.
+ echo wp_kses_post(
+ sprintf(
+ __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
+ '<a target="_blank" href="https://wedevs.com/wp-user-frontend-pro/">',
'</a>'
)
);🧰 Tools
🪛 GitHub Check: Run PHPCS inspection
[failure] 265-265:
A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
[failure] 264-264:
Whitespace found at end of line
[failure] 263-263:
Whitespace found at end of line
🤖 Prompt for AI Agents
In `@wpuf.php` around lines 263 - 269, Remove the trailing whitespace on the
sprintf block lines and add a translators comment immediately above the __()
call to explain the two HTML placeholder arguments (e.g., // translators: %1$s
opening anchor tag for free/pro link, %2$s closing anchor tag), and update the
anchor href used in the sprintf placeholders so the anchor wrapping "WP User
Frontend Pro" points to the Pro product URL instead of the free plugin URL; keep
the current call structure using sprintf(...) passed into wp_kses_post(...) and
ensure no extra spaces remain.
fix #1785
This line appears to be incorrectly formatted:
wp-user-frontend/wpuf.php
Line 264 in c7ed209
The line isn’t formatted correctly. The
wp_kses_post()function only accepts one parameter, so the additional arguments passed tosprintf()are ignored. As a result, the string isn’t being processed as intended.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.