[Zope-CMF] how to modify the add user method?

Dan L. Pierson dan@control.com
Wed, 01 Aug 2001 11:19:10 -0400


--On Wednesday, August 01, 2001 07:56:59 AM -0400 Jens Vagelpohl 
<jens@zope.com> wrote:

> - create your own Membership Tool by subclassing from
> CMFDefault/MembershipTool.py - implement addMember in your new membership
> tool class with all the modifications you want - replace the default
> membership tool in the CMF with your own
>
> that's the "clean and correct" way of doing it. for a code example look
> at these files:
>
> http://cvs.dataflake.org:8080/CMFLDAP/

There are two other hooks that may make this easier and, IMHO, just as
clean and correct:

1. If all you need to add is additional member properties, the standard
addMember processing calls member.setMemberProperties with *all* the
properties from the registration form.  The default MemberDataTool turns
this into a call on MemberData.setMemberProperties (via a path I don't
remember) which filters them to the properties declared in the 
MemberDataTool.

This means that if you are using the default membership support you can
define additional member properties by adding them to portal_memberdata's
Properties tab and the registration form.

If you are not using the default membership support you can make your
member object (e.g. ZClass) implement setMemberProperties (this is what
we do for LoginManager based members).

2. The last thing RegistrationTool.addMember does is call
RegistrationTool.afterAdd.  This means that you can subclass
CMFCore.RegistrationTool and define your own afterAdd method.
We have one which simply calls a PythonScript skin method named
new_member_actions to do any additional member processing.
IMHO, this would be a good standard feature for a future CMF.

>
> jens
>
> On Wednesday, August 1, 2001, at 04:44 , <josh@pdxbands.com> wrote:
>
>> Looking for a way to modify the add user call. I would like to be able
>> to  do
>> some additional features at the time a user is created.
>>
>> Which file do I need to modify?  Or, can I just put an external method
>> call
>> when a user is created?
>>
>> Thanks.
>>
>> Josh
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests
>