Solved

Is it possible to customize the "no permissions" notice for different pages?

  • 31 January 2024
  • 8 replies
  • 46 views

Userlevel 1

I’d like to customize the “you don’t have permissions to view this page” error so that it is unique when triggered from a specific page. The use case is that we have a private partners portal, and if users click there, we’d like the error message to provide them an email to our Partnerships team to request access. However, from other spaces on the community where users encounter permission issues, we don’t want to show this email because it wouldn’t relate to the partnerships team.

 

Is this possible to do?

 

 

icon

Best answer by DannyPancratz 31 January 2024, 18:54

View original

8 replies

Userlevel 6
Badge +7

Control > Customization > Phrases > search for error.forbidden.title

I’m not sure if the front-end Phrases tool will work.

If you don’t see it, that means it is hidden. But you can add it with Add Phrase in the upper right corner. 

Module: Common

Key: error.forbidden.title

Userlevel 6
Badge +7

Oh, shoot. I didn’t read your question specifically enough. Sorry about that...

Good question, I’m not sure if you can specify or customize by page. My guess is probably not, but it might be able to be done via Third Party Script. 

Userlevel 6
Badge +7

Is this linked in your navigation menu? How would they find the page? 

If it’s the menu, I might have a semi-complicated, but workable solution.

(sorry to spam you with replies)

Userlevel 1

Hey Danny,

 

No worries, thanks for the help. Right now, the space is linked from a Quick Links tile on a custom page as the primary entry point. But yes, it also shows up in the Discussions auto-generated top-nav menu. Interested to hear about this “semi-complicated” solution 👀

Userlevel 1

A third-party script does make sense, I could see how that would work

Userlevel 1

For anyone who’s curious, this is the script I added to replace the text on the page:

 

<script>
if (window.location.href === "https://community.front.com/p/partners-portal") {
// Check if the class of the body is '403'
var bodyElement = document.body;
if (bodyElement.classList.contains('403')) {

// Replace the text if conditions are true
var contactElement = document.body;
if (contactElement.innerText.includes("contact community@front.com")) {
contactElement.innerHTML = contactElement.innerHTML.replace("contact community@front.com", "contact partnerships@front.com");
}
}
}
</script>

 

Userlevel 6
Badge +7

@logicalhare your solution is much better than I would have proposed. 

If you’re looking to put this in your Navigation Menu, the solution I was going to propose is what I call “phantom” categories. 

  1. (actual) partner portal - permissioned accordingly via custom role
  2. (phantom) partner portal - permissioned with the opposite

Then redirect the category link (via third party script) for #2 to a custom page with whatever message, links etc you want to provide. 

The permissions would have it so that everyone sees “Partner Portal” in their drop down, but only the one they have access to. And the categories would have different category IDs on the end of their URL, allowing you to specify the link redirect. 

 

Userlevel 1

@DannyPancratz That’s a neat approach as well if we want to surface a more robust “non-permissioned” experience. Thanks!

Reply