Monday, March 31, 2008

How to create default content in Plone's Member Area.

For a portal we're developing, I wanted each member to get certain content put in their Member Folder by default.

For this reason, I created a special content type called MemberFolder which generalizes from ATFolder. However, a at_post_create_script on this doesn't work when invoked by Plone's "member add mechanism" (only when invoked directly, for example via the "add" menu.

It turns out that Plone's membership tool calls a method called notifyMemberAreaCreated on the newly created member folder. So all you have to do is add this method to your portal's default Member Folder type, and put your object creation stuff in it.

edit 22-05-2008:
It's even easier, because by acquisition the script doesn't have to be on the content type itself. Thanks Wiggert Akkerman for this hint.
See the complete how-to on plone.org