Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
By now I have pretty much all functionality that I desired on our website, working. Except one little thing: when an authenticated user tries to access a page for which he or she does not have authorization, then this yellow 'not authorized' page appears. All other error pages are in our website's styles and colors, except that one. For some reason I cannot figure out how I can customize that page. I would like to style it like the login page, but with a red 'not authorized' text.

How can I customize that page?
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Please see viewtopic.php?f=5&t=10241 (under the heading 'Theming') on how to override the system snippets used by Couch.

Once you understand how that works, copy the core 'couch\theme\_system\insufficient_privileges.html' (the snippet showing the 'yellow' box) into your custom theme folder.

You may now modify this snippet to use whatever markup/style you desire.

Hope this helps.

I was playing a bit with this the other day. What I did was, create a subfolder 'twirl' and copy the insufficient_privileges.html into it. Also, I copied styles.css (and the other two files, for that matter) from the sample subfolder into it, and added the following line to the styles.css which is now present in the twirl subfolder:

Code: Select all
<link href="<cms:show k_site_link />css/styles.css" rel="stylesheet"/>

This line is the only line in the file. What I expect is that the insufficient_privileges.html will now be rendered in such a way that a link to the style sheet of the site is added to the head tag and hence the page will be styled according to the site styling.

But I must do something wrong, because nothing changes: insufficient_privileges.html is shown in standard CouchCMS styling, not in our site's styling. What am I (still) doing wrong here?
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking

I get the point now. I incorrectly assumed that the <cms:render> tags were required for the page. They are not, and I now just replaced the code with my own code, adding a reference to my style sheets and reusing the <cms:localize> tags for the texts. The page is now fully in our website's style! Excellent, thanks again!

For those after me who might have the same question, here's an (adapted) snippet of my code to get the idea:
Code: Select all
<cms:embed "html_head.inc" />
<body>
   <div id="wrapper">   
      <div class="card my-4 border border-danger rounded">
         <div class="card-body">
            <h4 class="text-dark">We are sorry...</h4>
              <p class="text-dark">
                 <cms:localize 'insufficient_privileges' /><br /><br />
                 <a href="<cms:show k_logout_link />"><cms:localize 'logout' /></a>
             </p>
         </div>
      </div>
   </div>
</body>
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
4 posts Page 1 of 1