Plone 3 - Clean dashboard programmatically - Setup a custom dashboard
Plone 3 offers a default dashboard for each user. The dashboard is composed by four columns which are portlet managers and the set of portlet assignments created by default are: news, events, recent items and review list. If you need to clean existing dashboards or setup a different default set of portlets for the user dashboard, you are on the good place!
Clean all existing dashboards
from zope.component import adapts, queryUtility from plone.portlets.interfaces import IPortletManager from plone.app.portlets.storage import UserPortletAssignmentMapping from plone.portlets.constants import USER_CATEGORY def cleanDashboardFor(userid): for name in ('plone.dashboard1', 'plone.dashboard2', 'plone.dashboard3', 'plone.dashboard4'): column = queryUtility(IPortletManager, name=name) if column is not None: category = column.get(USER_CATEGORY, None) if category is not None: manager = category.get(userid, None) if manager is not None: # overrides the manager with an empty mapping del category[userid] category[userid] = \ UserPortletAssignmentMapping(manager=name, category=USER_CATEGORY, name=userid) # Remove all portlets from the users's dashboards for userid in plone.Members.objectIds(): cleanDashboardFor(userid)
Setup a custom dashboard
This how-to by Ricardo Alves explains how to setup the default set of portlets for the user dashboard.