Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Error message For Denied Forums

We have some archived content on our forums that internal staff tend to want to access (when they most likely dont need to).

I'm wondering if I can set a custom message/text to be displayed when someone finds themselves trying to access those archived forums. 

This will allow me to guide them on how to get access

Community Manager at AppDynamics
2 Replies 2

Hi @i_am_ryan ,

We have some similar user cases on our end. Since it seems you want to guide them to request access (rather than just prevent access to begin with), I think the best tool to use is conditional expressions in Freemarker. You'll need some experience with Studio, Freemarker, HTML and CSS to do, so I recommend reviewing Khoros' developer documentation and a Freemarker reference or two

First, a disclaimer: I'm no web developer, and couldn't tell you if this was the best way to do this. But it is pretty straightforward, and works well enough for us.

Here's a simple example of this in action on one of our Beta pages to direct users to login to see what Beta content they can access (view the unauthenticated page to see the conditional content):

Here's a code sample:

<#if user.anonymous>   
    <div class="box-landing-header">
        <div class="box-landing-title-copy">
            <div class="box-community-tip-box">
                <h4>Looking for something?</h4>
<p>Be sure to <a href="/plugins/common/feature/oauth2sso/sso_login_redirect"><strong>sign in</strong></a> to see all resources available to you.</p>


The divs are there mostly to leverage our CSS styles, but the <#if user.anonymous>...</#if> is the code that checks if the user is authenticated or not.

You can also check if the user is in a certain role using a combination of a REST call to learn what roles they have and then checking if the role you want is in that list:

<#assign user_is_test_role = false />
<#if user.registered >
    <#list restadmin("/users/id/${}/roles").roles.role as role> 
    	<#if && ( == "Test Role") >
    		<#assign user_is_test_role = true />


Hope that can get you started!

Thanks, I will explore this option.

What I've thought about doing so far is I found the error that gets triggered by accessing a denied space and editing that error to a custom message in the text editor. 

There might be some random cases where a user stumbles across a denied page, but there would not be any info on there that would be too bad. Just have messaging that is geared towards users and internal staff. 

Community Manager at AppDynamics

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.