blog.allow_access_requests
Previous  Top  Next

A boolean variable that is true if the blog is set to display a page that allows the reader to request access to a restricted category.

The setting that allows the reader to request access to restricted category is controlled by the Allow readers to request access to private content checkbox located in the Options sidebar of the General page in the Settings section. If this checkbox is checked, blog.allow_access_requests is set to true.

In the default base template, blog.allow_access_requests is used to determine whether to show a "request access" link to a logged-in reader who has been denied access to a restricted category. The reader clicks this link to send an email message to the blog administrator's email address. The message looks like this:

From: [Reader's first name] [Reader's last name]  
Subject: Access request received from [Reader's username]  
Date: [Date and time request was made]  
To: [Administrator's name]  
 
[Reader's first name] [Reader's last name] ([Reader's username])has requested access to view category [Category name] for blog [Blog name].  
 
To enable access for [Reader's username] to this category, follow the link below:  
 
[Link]  

Following the link (in many mail clients, clicking the link will follow it) will grant the user access permission to view the category.



Example
The example below is a simplified version of the code from the default base template. If all these conditions are true:

·The reader does not have permission to view the restricted category (that is, if category.restricted is true)  
·The reader is logged in (that is, authenticated is true)  
·The reader is allowed to ask for permission to view the restricted category (that is, if blog.allow_access_requests is true)  

...then the reader will be shown an empty category page with the text "The category you are viewing is restricted. Click here to request viewing access". The phrase "Click here" will be linked to an URL that if accessed will automatically send the access request email to the blog's administrator. This URL is contained by the template variable category.request_access_url.

{{if category.restricted}}  
The category you are viewing has restricted privileges.  
 
{{if authenticated}}  
 
{{if blog.allow_access_requests}}  
The category you are viewing is restricted. <a href="{{category.request_access_url}}">Click here</a> to request viewing access.  
{{/if}}  
 
{{else}}  
  Please login or <a href="{{users_signup_url}}">signup</a> for a new blogware account.  
 
{{/if}}   
 
{{/if}}