Attention

This document was written for an unsupported version of Plone, Plone 2.1.x, and was last updated 898 days ago.

For more information, see the version support policy.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Hiding authors' information pages site wide

by hvelarde last modified Dec 06, 2009 10:11 PM
This document explains briefly how to remove access to authors' information pages for anonymous visitors of a site.

In case you need to hide the links to the authors' information pages (i.e. you don't want visitors to easily snoop around member folders and look information showed by the author.cpt template) you have to customize the following page templates in your Zope instance in the following way:

author.cpt

This is the file we don't want anonymous users to access, so the easiest way to do it is by changing its view permission to authenticated users only. You can do so in two ways: by changing the permission of these file through the ZMI or by modifying the associated author.cpt.metadata file. Both files are located under CMFPlone\skins\plone_content.

[security]
View=0:Authenticated

folder_listing.pt

This file is located under CMFPlone\skins\plone_content.

<tal:name tal:condition="item_creator"
     tal:define="author python:mtool.getMemberInfo(item_creator)">
  <span i18n:translate="label_by_author">
    by
  <a href="#"
     tal:attributes="href string:${portal_url}/author/${item_creator}"
     tal:content="python:author and author['fullname'] or item_creator"
     tal:omit-tag="python:not author or isAnon"
     i18n:name="author">
    Bob Dobalina
  </a>
  </span>

</tal:name>

folder_summary_view.pt

This file is located under CMFPlone\skins\plone_content.

<tal:newsitem condition="python: item_type == 'News Item'">
  <tal:name tal:condition="item_creator"
            tal:define="author python:mtool.getMemberInfo(item_creator)">
    <span i18n:translate="label_by_author">
      by
    <a href="#"
       tal:attributes="href string:${portal_url}/author/${item_creator}"
       tal:content="python:author and author['fullname'] or item_creator"
       tal:omit-tag="python:not author or isAnon"
       i18n:name="author">
      Bob Dobalina
    </a>
    </span>
  </tal:name>
    &mdash;
    <span tal:replace="python:toLocalizedTime(item_modified,long_format=1)">
    August 16, 2001 at 23:35:59
    </span>
</tal:newsitem>

folder_tabular_view.pt

This file is located under CMFPlone\skins\plone_content.

<td tal:condition="show_about">
  <tal:name tal:condition="item_creator"
            tal:define="author python:mtool.getMemberInfo(item_creator)">
    <a href="#"
       tal:attributes="href string:${portal_url}/author/${item_creator}"
       tal:content="python:author and author['fullname'] or item_creator"
       tal:omit-tag="python:not author or isAnon">
      Bob Dobalina
    </a>
  </tal:name>
</td>

header.pt

This file is used to create the header part of all pages in the site. It includes a link element to authors' information pages but this is not easily accessible to average visitors and is neither supported in all browsers, so you may want to change it or not. It is located under CMFPlone\skins\plone_templates.

<link rel="author"
      href=""
      title="Author information"
      i18n:attributes="title title_author_info"
      tal:attributes="href string:${portal_url}/author/${here/Creator}" />

Additional changes

All of these templates (except header.pt) have calls to the toLocalizedTime.py script located under CMFPlone\skins\plone_scripts. As your modified templates will be no longer on the same layer, you will need to change all of those calls adding a "context" preffix like this one:

python:context.toLocalizedTime(item_end,long_format=1)

In case you fail to do this, you will start finding a bunch of NameError: name 'toLocalizedTime' is not defined messages all over the place.

Other page templates

There are a couple of other files that reference the authors' information pages, but as long as I understand they are only accessible to authenticated users:

  • document_byline.pt and review_history.pt (under CMFPlone\skins\plone_content)

  • personalize_form.cpt (under CMFPlone\skins\plone_prefs)
  • global_personalbar.pt (under CMFPlone\skins\plone_templates)

Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.