Skip to content

Commit b903f85

Browse files
authored
Redirect password issue text change. (#1355)
1 parent 7b1cdb0 commit b903f85

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

assets/js/admin/login-settings.js

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,56 @@
352352
).on("change", function () {
353353
urm_validate_login_page_settings($(this));
354354
});
355+
356+
highlight_deep_linked_setting();
355357
});
356358

359+
/**
360+
* Deep-link support: when arriving with ?highlight=<field_id> (e.g. from the
361+
* login block editor), open the relevant tab/section and flash the setting.
362+
*/
363+
function highlight_deep_linked_setting() {
364+
var params = new URLSearchParams(window.location.search);
365+
var field_id = params.get("highlight");
366+
367+
if (!field_id) {
368+
return;
369+
}
370+
371+
// admin.js builds the .form-settings-tab section nav on ready; wait for it.
372+
setTimeout(function () {
373+
switch_to_tab_and_section(
374+
params.get("tab") || "ur-tab-login-form-settings",
375+
params.get("tab-item")
376+
);
377+
378+
setTimeout(function () {
379+
var $container = $("#" + field_id).closest(
380+
".user-registration-login-form-global-settings"
381+
);
382+
383+
if (!$container.length) {
384+
return;
385+
}
386+
387+
$("html, body").animate(
388+
{ scrollTop: $container.offset().top - 120 },
389+
500
390+
);
391+
392+
$container.css({
393+
outline: "2px solid #475bb2",
394+
"outline-offset": "4px",
395+
"border-radius": "6px",
396+
transition: "outline-color .3s ease"
397+
});
398+
setTimeout(function () {
399+
$container.css({ outline: "", "outline-offset": "" });
400+
}, 3000);
401+
}, 300);
402+
}, 500);
403+
}
404+
357405
function urm_validate_login_page_settings($this) {
358406
var field_container = $this.closest(
359407
".user-registration-login-form-global-settings--field"
@@ -425,7 +473,9 @@
425473
// If in Form Settings tab and section_id is provided, switch to that section
426474
if (tab_id === "ur-tab-login-form-settings" && section_id) {
427475
var $section_nav_item = $(
428-
"a[href='#" +
476+
".form-settings-tab[id='" +
477+
section_id +
478+
"'], a[href='#" +
429479
section_id +
430480
"'], li#" +
431481
section_id +

src/blocks/blocks/login-form/Edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const Edit = (props) => {
3636
title={__("Login Form Settings", "user-registration")}
3737
>
3838
<p>
39-
Want to configure where users will be redirected to after login or logout? Click <a target="_blank" href="/wp-admin/admin.php?page=user-registration-login-forms&tab=ur-tab-login-form-settings&tab-item=advanced-settings">here.</a>
39+
Want to control where users land after they log in or log out? Configure it <a target="_blank" href="/wp-admin/admin.php?page=user-registration-login-forms&tab=ur-tab-login-form-settings&tab-item=advanced-settings&highlight=user_registration_login_options_enable_custom_redirect">here</a>.
4040
</p>
4141
<SelectControl
4242
key="ur-gutenberg-login-user-login-state"

0 commit comments

Comments
 (0)