Hi Everybody!
I have a Help Center theme that was edited some time ago to hide one specific form from all users, except the members of a specified organization and has been working fine ever since.
But things evolve and we now need to hide two forms. One from all but one organization and one from all but two organizations. However, the new code I have in place isn't working correctly and I'm not really sure why. But I'm a real novice with HTML so that's not really all that surprising.
When the new code is added to a test template and the preview is run. It does not change the visible forms and appears to still be using the code that is currently in the live theme.
I have also swapped the live theme after hours to confirm that it was not a buggy preview feature. But the behavior was consistent.
The new form is not visible despite the account used for testing being an administrator and in the correct organization. While the old form was still visible despite the test account not being in the required organization.
Below is the code that the live site is using.
document.addEventListener('DOMContentLoaded', function() {
// Key map
var ENTER = 13;
var ESCAPE = 27;
var SPACE = 32;
var UP = 38;
var DOWN = 40;
var TAB = 9;
var i = 0;
var checkExist = setInterval(function() {
i++;
if ($("a.nesty-input").length){
clearInterval(checkExist);
$("a.nesty-input").each(function() {
$(this).bind( "click", function() {
for (var c in HelpCenter.user.organizations) {
if (HelpCenter.user.organizations[c].name === "Managers"){
$("#360003482932").show();
}
else{$("#360003482932").hide()}
And here is the new code that replaced it.
document.addEventListener('DOMContentLoaded', function() {
// Key map
var ENTER = 13;
var ESCAPE = 27;
var SPACE = 32;
var UP = 38;
var DOWN = 40;
var TAB = 9;
var i = 0;
var checkExist = setInterval(function() {
i++;
if ($("a.nesty-input").length){
clearInterval(checkExist);
$("a.nesty-input").each(function() {
$(this).bind( "click", function() {
for (var c in HelpCenter.user.organizations) {
if (HelpCenter.user.organizations[c].name === "Managers" || HelpCenter.user.organizations[c].name === "HR"){
$("#360003482932").show();
}
else{$("#360003482932").hide()}
if (HelpCenter.user.organizations[c].name === "HR"){
$("#4992348743700").show();
}
else{$("#4992348743700").hide()}
As you can see the changes are not very significant. Does anyone have any idea why the HC would still be producing the same behavior now as before the change?
I see you have created a conversation for our technical support team, with the same question.
I will reach out in this conversation then, if this suit.
Thank you