Custom Permissions Error Message

By Ed Johnson Ed Johnson

Description

The standard permissions error message that pops up has messages preset by Wikidot. Using a bit of CSS you can customize this message in a way that might better fit the needs of your site.

For example, you have a site that is exposed to the public, but is only edited and maintained by you or a small group of users. The default permissions error message includes a rather generic message that says, "Only site administrators and perhaps selected moderators are allowed to do it." Well, there's no "perhaps" about it in this example! We don't want anyone else editing our page!

Similarly, if an unauthorized user tries to create a new page, the default error message says, "Sorry, you can not create a new page in this category. Only site administrators and perhaps selected moderators are allowed to do it. Sign in as Wikidot user" and contains a link to sign into Wikidot. Again, it would be nice to have a simpler message that relates to our site and removes any references to Wikidot or signing in.

Here is an example of a couple of standard error messages:

permission-error-standard-1.jpg

permission-error-standard-2.jpg

With some simple CSS edits, we can customize the look of these messages:

permission-error-custom.jpg

Code

Add this to your site's custom CSS. Note that some of the colors and margins may need to be edited to match the current theme of your site.

/*PermissionErrors
============================== */
/*Titlebaroftheerrorwindow*/
#ohandle-1.title{color:#F5F5F5; /*setthecolortomatchthebackgroundcolortohidethedefaulttext*/
}#ohandle-1.title:before{content: "Administrative Use Only"; /*displaythiscontentbeforethetitletext*/
color: darkred; /*changefontcolorifyouwish*/
font-size:18px; /*changefontsizeifyouwish*/
}
 
/*completelyhidetheparagraphtextwiththedefaultWikidotmessages*/ 
#owindow-1.owindowp{display:none; 
}
 
/*Hide "PleaseNote:" text*/
#owindow-1.owindowh1{color:white;
}#owindow-1.owindowh1:before{content: "Sorry, that option is for administrative use only."; /*displaythisbeforethe "PleaseNote" text*/
color:black; /*changefontcolorifyouwish*/
font-size:18px; /*changefontsizeifyouwish*/
}

In action

This technique was implemented on this site: mascot-golf (try pressing CTRL-E on the home page to see the customized error block)


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by Ed Johnson


Rate this solution

If you think this solution is useful — rate it up!

rating: +9
page revision: 7, last edited: 14 Feb 2012 03:42
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).

AltStyle によって変換されたページ (->オリジナル) /