Skip to content

Commit b427741

Browse files
authored
feat: Update settings API for login form layout customization support (#1716)
* feat: Update settings API for login form layout customization support - Enhanced wp_kses() to allow SVG elements and attributes - Added support for radio image field type rendering - Expanded allowed HTML tags to include: svg, path elements with required attributes - Allows div, a, span elements needed for image-based option selection This update enables the login form layout customization feature by providing the necessary settings API infrastructure for visual layout selection with SVG icons in the admin interface. * fix: remember me design * fix: ksses html color swatchers * fix: pro preview?
1 parent 6974adf commit b427741

File tree

13 files changed

+518
-7
lines changed

13 files changed

+518
-7
lines changed

Lib/WeDevs_Settings_API.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,20 @@ function callback_color( $args ) {
538538
$html .= wpuf_get_pro_preview_html();
539539
}
540540

541-
echo wp_kses_post( $html );
541+
// Allow input tags with necessary attributes for color picker fields
542+
// wp_kses_post() strips <input> tags by default, so we need to explicitly allow them
543+
$allowed_html = wp_kses_allowed_html( 'post' );
544+
$allowed_html['input'] = [
545+
'type' => true,
546+
'class' => true,
547+
'id' => true,
548+
'name' => true,
549+
'value' => true,
550+
'data-default-color' => true,
551+
'disabled' => true,
552+
];
553+
554+
echo wp_kses( $html, $allowed_html );
542555
}
543556

544557
/**
@@ -740,8 +753,8 @@ function script() {
740753
?>
741754
<script>
742755
jQuery(document).ready(function($) {
743-
//Initiate Color Picker
744-
$('.wp-color-picker-field').wpColorPicker();
756+
//Initiate Color Picker (skip disabled fields for pro preview)
757+
$('.wp-color-picker-field:not([disabled])').wpColorPicker();
745758

746759
// Switches option sections
747760
$('.group').hide();

assets/css/admin.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,3 +1549,25 @@ body.wpuf-modal-open {
15491549
.wpuf-subscription-pack-settings .subscription-nav-content section .form-table td {
15501550
padding: 15px 0;
15511551
}
1552+
/* Disabled color picker for pro preview */
1553+
.wp-picker-container input[type="text"].wp-color-picker-field[disabled] {
1554+
cursor: not-allowed !important;
1555+
opacity: 0.5 !important;
1556+
background-color: #f0f0f0 !important;
1557+
pointer-events: none !important;
1558+
}
1559+
.wp-picker-container .wp-color-result[disabled],
1560+
.wp-picker-container input[disabled] ~ .wp-picker-input-wrap .wp-color-result {
1561+
cursor: not-allowed !important;
1562+
opacity: 0.5 !important;
1563+
pointer-events: none !important;
1564+
}
1565+
.wp-picker-container .wp-color-result[disabled]:hover,
1566+
.wp-picker-container input[disabled] ~ .wp-picker-input-wrap .wp-color-result:hover {
1567+
background-color: inherit !important;
1568+
border-color: inherit !important;
1569+
}
1570+
.wp-picker-container .wp-color-result[disabled]:active,
1571+
.wp-picker-container input[disabled] ~ .wp-picker-input-wrap .wp-color-result:active {
1572+
transform: none !important;
1573+
}

assets/css/login-form-settings.css

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/**
2+
* Login Form Settings - Admin Styles
3+
*
4+
* Static styles for the login form settings page in admin area.
5+
* Radio image selection styles for layout chooser.
6+
*
7+
* @package WP User Frontend
8+
* @subpackage Assets/CSS
9+
*/
10+
11+
.wpuf-radio-image-wrapper {
12+
display: flex;
13+
flex-wrap: wrap;
14+
gap: 15px;
15+
}
16+
17+
.wpuf-radio-image-option {
18+
flex: 0 0 calc(25% - 12px);
19+
min-width: 200px;
20+
}
21+
22+
.wpuf-radio-image-option input[type='radio'] {
23+
position: absolute;
24+
opacity: 0;
25+
}
26+
27+
.wpuf-radio-image-option label {
28+
position: relative;
29+
display: block;
30+
cursor: pointer;
31+
border: 2px solid #ddd;
32+
border-radius: 8px;
33+
padding: 10px;
34+
transition: all 0.3s ease;
35+
background: #fff;
36+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
37+
}
38+
39+
.wpuf-radio-image-option label:hover {
40+
border-color: #0073aa;
41+
box-shadow: 0 4px 8px rgba(0, 115, 170, 0.2);
42+
transform: translateY(-2px);
43+
}
44+
45+
.wpuf-radio-image-option input[type='radio']:checked + label {
46+
border-color: #0073aa;
47+
background-color: #f0f8ff;
48+
box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
49+
}
50+
51+
.wpuf-radio-image-option input[type='radio']:checked + label::after {
52+
content: '✓';
53+
position: absolute;
54+
top: 12px;
55+
right: 12px;
56+
background: #0073aa;
57+
color: white;
58+
width: 20px;
59+
height: 20px;
60+
border-radius: 100%;
61+
display: flex;
62+
align-items: center;
63+
justify-content: center;
64+
font-weight: bold;
65+
font-size: 12px;
66+
line-height: 24px;
67+
text-align: center;
68+
}
69+
70+
.wpuf-radio-image-option img {
71+
max-width: 100%;
72+
height: auto;
73+
display: block;
74+
border-radius: 4px;
75+
}
76+
77+
/* Free plugin specific: Fix WordPress Settings API table layout */
78+
/* Force horizontal flex layout inside form tables */
79+
80+
/* Override fieldset constraints */
81+
.form-table fieldset {
82+
max-width: none !important;
83+
}
84+
85+
.form-table td fieldset {
86+
max-width: 100% !important;
87+
width: 100% !important;
88+
}
89+
90+
/* Force flex display on wrapper - works in all browsers */
91+
.form-table .wpuf-radio-image-wrapper,
92+
.form-table fieldset .wpuf-radio-image-wrapper,
93+
.form-table td .wpuf-radio-image-wrapper {
94+
display: flex !important;
95+
flex-wrap: wrap !important;
96+
flex-direction: row !important;
97+
width: 100% !important;
98+
gap: 15px !important;
99+
}
100+
101+
/* Ensure each option displays inline */
102+
.form-table .wpuf-radio-image-option {
103+
flex: 0 0 calc(25% - 12px) !important;
104+
min-width: 200px !important;
105+
display: inline-flex !important;
106+
vertical-align: top !important;
107+
}
108+
109+

assets/images/login-layouts/layout1.svg

Lines changed: 24 additions & 0 deletions
Loading

assets/images/login-layouts/layout2.svg

Lines changed: 24 additions & 0 deletions
Loading

assets/images/login-layouts/layout3.svg

Lines changed: 26 additions & 0 deletions
Loading

assets/images/login-layouts/layout4.svg

Lines changed: 28 additions & 0 deletions
Loading

assets/images/login-layouts/layout5.svg

Lines changed: 26 additions & 0 deletions
Loading

assets/images/login-layouts/layout6.svg

Lines changed: 26 additions & 0 deletions
Loading

assets/images/login-layouts/layout7.svg

Lines changed: 30 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)