-
Notifications
You must be signed in to change notification settings - Fork 154
feat: Update settings API for login form layout customization support #1716
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
Merged
sapayth
merged 5 commits into
weDevsOfficial:develop
from
arifulhoque7:feature/login-form-layout-customization
Dec 4, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
944903d
feat: Update settings API for login form layout customization support
arifulhoque7 06509a9
fix: remember me design
arifulhoque7 4e86f5f
fix: ksses html color swatchers
arifulhoque7 17abb18
fix: pro preview?
arifulhoque7 ce20adc
Merge branch 'weDevsOfficial:develop' into feature/login-form-layout-…
arifulhoque7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /** | ||
| * Login Form Settings - Admin Styles | ||
| * | ||
| * Static styles for the login form settings page in admin area. | ||
| * Radio image selection styles for layout chooser. | ||
| * | ||
| * @package WP User Frontend | ||
| * @subpackage Assets/CSS | ||
| */ | ||
|
|
||
| .wpuf-radio-image-wrapper { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 15px; | ||
| } | ||
|
|
||
| .wpuf-radio-image-option { | ||
| flex: 0 0 calc(25% - 12px); | ||
| min-width: 200px; | ||
| } | ||
|
|
||
| .wpuf-radio-image-option input[type='radio'] { | ||
| position: absolute; | ||
| opacity: 0; | ||
| } | ||
|
|
||
| .wpuf-radio-image-option label { | ||
| position: relative; | ||
| display: block; | ||
| cursor: pointer; | ||
| border: 2px solid #ddd; | ||
| border-radius: 8px; | ||
| padding: 10px; | ||
| transition: all 0.3s ease; | ||
| background: #fff; | ||
| box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
| } | ||
|
|
||
| .wpuf-radio-image-option label:hover { | ||
| border-color: #0073aa; | ||
| box-shadow: 0 4px 8px rgba(0, 115, 170, 0.2); | ||
| transform: translateY(-2px); | ||
| } | ||
|
|
||
| .wpuf-radio-image-option input[type='radio']:checked + label { | ||
| border-color: #0073aa; | ||
| background-color: #f0f8ff; | ||
| box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3); | ||
| } | ||
|
|
||
| .wpuf-radio-image-option input[type='radio']:checked + label::after { | ||
| content: '✓'; | ||
| position: absolute; | ||
| top: 12px; | ||
| right: 12px; | ||
| background: #0073aa; | ||
| color: white; | ||
| width: 20px; | ||
| height: 20px; | ||
| border-radius: 100%; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| font-weight: bold; | ||
| font-size: 12px; | ||
| line-height: 24px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .wpuf-radio-image-option img { | ||
| max-width: 100%; | ||
| height: auto; | ||
| display: block; | ||
| border-radius: 4px; | ||
| } | ||
|
|
||
| /* Free plugin specific: Fix WordPress Settings API table layout */ | ||
| /* Force horizontal flex layout inside form tables */ | ||
|
|
||
| /* Override fieldset constraints */ | ||
| .form-table fieldset { | ||
| max-width: none !important; | ||
| } | ||
|
|
||
| .form-table td fieldset { | ||
| max-width: 100% !important; | ||
| width: 100% !important; | ||
| } | ||
|
|
||
| /* Force flex display on wrapper - works in all browsers */ | ||
| .form-table .wpuf-radio-image-wrapper, | ||
| .form-table fieldset .wpuf-radio-image-wrapper, | ||
| .form-table td .wpuf-radio-image-wrapper { | ||
| display: flex !important; | ||
| flex-wrap: wrap !important; | ||
| flex-direction: row !important; | ||
| width: 100% !important; | ||
| gap: 15px !important; | ||
| } | ||
|
|
||
| /* Ensure each option displays inline */ | ||
| .form-table .wpuf-radio-image-option { | ||
| flex: 0 0 calc(25% - 12px) !important; | ||
| min-width: 200px !important; | ||
| display: inline-flex !important; | ||
| vertical-align: top !important; | ||
| } | ||
|
|
||
|
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
Fix default fallback and attribute escaping in renderer
Two issues:
$args['std']but the field usesdefault. Initial selection may be empty.titleandaltshould useesc_attr(). Currently$labelisesc_htmlonly.Apply:
function wpuf_render_login_layout_field( $args ) { @@ - $value = get_option( $args['section'] ); - $current = $value[ $args['id'] ] ?? $args['std'] ?? ''; - $disabled = ! empty( $args['is_pro_preview'] ) && $args['is_pro_preview'] ? 'disabled' : ''; + $value = get_option( $args['section'] ); + $current = isset( $value[ $args['id'] ] ) + ? $value[ $args['id'] ] + : ( $args['default'] ?? ( $args['std'] ?? '' ) ); + $is_disabled = ! empty( $args['is_pro_preview'] ) && $args['is_pro_preview']; @@ - foreach ( $args['options'] as $key => $option ) { + foreach ( (array) $args['options'] as $key => $option ) { $checked = checked( $current, $key, false ); - $label = esc_html( $option['label'] ?? $key ); + $label = $option['label'] ?? $key; + $label_attr = esc_attr( $label ); + $label_text = esc_html( $label ); $image = esc_url( $option['image'] ?? '' ); printf( '<div class="wpuf-radio-image-option"> - <input type="radio" id="%1$s_%2$s" name="%3$s[%1$s]" value="%2$s" %4$s %5$s> - <label for="%1$s_%2$s" title="%6$s">', + <input type="radio" id="%1$s_%2$s" name="%3$s[%1$s]" value="%2$s" %4$s %5$s> + <label for="%1$s_%2$s" title="%6$s">', esc_attr( $args['id'] ), esc_attr( $key ), esc_attr( $args['section'] ), $checked, - $disabled, - $label + $is_disabled ? 'disabled="disabled"' : '', + $label_attr ); if ( $image ) { - printf( '<img src="%s" alt="%s">', $image, $label ); + printf( '<img src="%s" alt="%s">', $image, $label_attr ); } - echo '</label></div>'; + echo wp_kses_post( '</label></div>' ); } @@ - if ( ! empty( $args['desc'] ) ) { - printf( '<p class="description">%s</p>', wp_kses_post( $args['desc'] ) ); - } + if ( ! empty( $args['desc'] ) ) { + printf( '<p class="description">%s</p>', wp_kses_post( $args['desc'] ) ); + }I'll help you verify the issues raised in this review comment. Let me search the codebase to understand the calling context and field definitions.
🏁 Script executed:
Length of output: 20
🏁 Script executed:
Length of output: 1027
🏁 Script executed:
Length of output: 5511
🏁 Script executed:
Length of output: 758
🏁 Script executed:
Length of output: 2579
🏁 Script executed:
Length of output: 531
🏁 Script executed:
Length of output: 3859
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 1696
🏁 Script executed:
Length of output: 3269
🏁 Script executed:
Length of output: 3278
🏁 Script executed:
Length of output: 5117
🏁 Script executed:
Length of output: 2524
🏁 Script executed:
Length of output: 2954
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 566
🏁 Script executed:
Length of output: 6138
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 7307
🏁 Script executed:
Length of output: 4538
🏁 Script executed:
Length of output: 1512
🏁 Script executed:
Length of output: 3352
🏁 Script executed:
Length of output: 1735
🏁 Script executed:
Length of output: 1202
🏁 Script executed:
Length of output: 1830
🏁 Script executed:
Length of output: 5108
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 192
🏁 Script executed:
Length of output: 1696
🏁 Script executed:
Length of output: 62
🏁 Script executed:
Length of output: 6
🏁 Script executed:
Length of output: 3342
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 4794
🏁 Script executed:
Length of output: 2717
Address default parameter mismatch and attribute escaping vulnerabilities
The review comment correctly identifies two critical issues:
Default parameter mismatch: The field definition (includes/functions/settings-options.php:475) provides
'default' => 'layout1', but the function (wpuf-functions.php:5754) reads$args['std']which doesn't exist in this context. Initial selection will be empty.Attribute escaping: The
titleandaltattributes (lines 5770, 5780) useesc_html()for$label, but HTML attributes requireesc_attr()per WordPress security standards.Disabled attribute format: The disabled attribute should be
'disabled="disabled"'(consistent with other fields at line 3722), not just'disabled'.Apply these fixes:
function wpuf_render_login_layout_field( $args ) { if ( empty( $args['section'] ) || empty( $args['id'] ) || empty( $args['options'] ) ) { return; } $value = get_option( $args['section'] ); - $current = $value[ $args['id'] ] ?? $args['std'] ?? ''; - $disabled = ! empty( $args['is_pro_preview'] ) && $args['is_pro_preview'] ? 'disabled' : ''; + $current = isset( $value[ $args['id'] ] ) + ? $value[ $args['id'] ] + : ( $args['default'] ?? ( $args['std'] ?? '' ) ); + $is_disabled = ! empty( $args['is_pro_preview'] ) && $args['is_pro_preview']; foreach ( $args['options'] as $key => $option ) { $checked = checked( $current, $key, false ); - $label = esc_html( $option['label'] ?? $key ); + $label = $option['label'] ?? $key; + $label_attr = esc_attr( $label ); + $label_text = esc_html( $label ); $image = esc_url( $option['image'] ?? '' ); printf( '<div class="wpuf-radio-image-option"> <input type="radio" id="%1$s_%2$s" name="%3$s[%1$s]" value="%2$s" %4$s %5$s> <label for="%1$s_%2$s" title="%6$s">', esc_attr( $args['id'] ), esc_attr( $key ), esc_attr( $args['section'] ), $checked, - $disabled, - $label + $is_disabled ? 'disabled="disabled"' : '', + $label_attr ); if ( $image ) { - printf( '<img src="%s" alt="%s">', $image, $label ); + printf( '<img src="%s" alt="%s">', $image, $label_attr ); } echo '</label></div>'; }📝 Committable suggestion
🤖 Prompt for AI Agents