Personal tools
You are here: Home Documentation How-tos How to create default content in Member Area
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

How to create default content in Member Area

This How-to applies to: Plone 2.5.x
This How-to is intended for: Server Administrators, Integrators, Customizers, Developers

Each member gets a member area created when they first log in. How to get certain content put in this folder by default?

Purpose

Suppose you want some default content placed in new members' home folder, just to help them along or because your site requires it for some purpose. For my use case, i want them to have a Bookmarks folder, hoping that this will draw their attention to this possibility.

Prerequisities

You should have knowledge about creating customized content types, and about adding content programmatically. This how-to is intended for use with Plone 2.5.

Step by step

  1. Via the ZMI, go to the portal_skins folder and select the custom folder.
  2. Add a notifyMemberAreaCreated script. This gets called by membership_tool when a new member first logs in. (Actually it gets called on the newly created member folder, acquisition will find the custom script.)

    # script to automatically create bookmarks folder in member's user area
    
    context.plone_log("Post create script running")
    bmId = 'bookmarks'
    bmTitle = 'My Bookmarks'
    context.invokeFactory('BookmarkFolder',id=bmId)
    bmfolder = getattr(context, bmId)
    bmfolder.setTitle(bmTitle)
    bmfolder.reindexObject()
    
    For this example to work, you should have ATBookmarks installed, otherwise, change it to Folder.
by khink — last modified April 29, 2008 - 22:59
Contributors: Wichert Akkerman
All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by