459a35086a904c5cbe1dcb5e73e9dfca58e926f9
1 ##parameters=member_id, given_name, name, password, member_email, send_password=False, **kw
4 from Products
.CMFCore
.utils
import getToolByName
5 from Products
.CMFDefault
.permissions
import ManageUsers
6 from Products
.Plinn
.RegistrationTool
import MODE_REVIEWED
8 mtool
= getToolByName(script
, 'portal_membership')
9 ptool
= getToolByName(script
, 'portal_properties')
10 rtool
= getToolByName(script
, 'portal_registration')
13 rtool
.addMember( id=member_id
, password
=password
,
14 properties
={'username': member_id
,
15 'given_name' : given_name
,
17 'email': member_email
} )
18 except ValueError, errmsg
:
19 return context
.setStatus(False, errmsg
)
21 if send_password
or (ptool
.getProperty('validate_email') and rtool
.getMode() != MODE_REVIEWED
):
22 rtool
.registeredNotify(member_id
)
23 if mtool
.checkPermission(ManageUsers
, mtool
):
24 return context
.setStatus(True, 'Member registered.')
26 return context
.setStatus(False, 'Success!')