Re: Memberdata Howto

<VasudevaService-K9y3B4ipJAZZAIG4hdpdiNBPR1lH4CV8@public.gmane.org> (Priyadarshan) Mon, 22 Mar 2004 22:06:57 -0500
Newsgroups gmane.org.misc.vasudeva-server.web
Message-ID <[email protected]>
Hi,

another excellent article by Dhyani. And you said you do not know  
English...

You can find it here:
http://www.vasudevaservice.com/technical_articles/add_member_properties

Two questions:

1) Can you specify Gender as a pull-down menu (like the "content  
editor" option?
Values would be:
	null (default)
	Male
	Female

2) Can you make it compulsory to choose (must be not null)?

Thanks


priyadarshan
Vasudeva Server



On Mar 21, 2004, at 5:52 AM, Dhyani wrote:

> Hi Priyadarshan,
>
> I had a long phone conversation with Jagrata yesterday, and he  
> suggested
> that I should write a HowTo on "how to add member properties" so that
> everybody can do it in the future. He said you might want to put this  
> into
> the fishbowl. I'm leaving this to you, whether you want to put it  
> there or
> not. So here comes the HowTo:
>
> *********************************************************************** 
> *****
> ***
> How to add member properties to a Plone site
> *********************************************************************** 
> *****
> ***
>
> Let's say you want to have a new member property called "gender" that  
> can be
> edited by the members on the "Personal Preferences" page.
>
> *********************************************************************** 
> *****
> ***
> Step 1: Add the new property to the portal_memberdata tool
> *********************************************************************** 
> *****
> ***
>
> On your Plone site, go to /portal_memberdata, click on the Properties  
> tab
> and add the new property:
> Name = gender, Value = (leave this empty, you could provide a default  
> value
> here), Type = string.
> Click on "Add" to add the new property.
>
> *********************************************************************** 
> *****
> ***
> Step 2: Customize the personalize_form so that your new property  
> becomes
> visible
> *********************************************************************** 
> *****
> ***
>
> On your Plone site, go to portal_skins/plone_prefs/personalize_form and
> click on "Customize" (if you haven't done this already).
> Then go to portal_skins/custom/personalize_form and insert the  
> following
> code into the Page template:
>
>             <div class="row" tal:define="error_gender errors/gender |
> nothing; gender python:request.get('gender',
> member.getProperty('gender'));">
>                 <div class="label">
>                     <span i18n:translate="label_gender">Gender</span>
>                     <div id="gender_help" i18n:translate="help_gender"
> class="help" style="visibility:hidden">
>                       You can specify your gender here.
>                     </div>
>                 </div>
>                 <div class="field" tal:attributes="class
> python:test(error_gender, 'field error', 'field')">
>                     <div tal:condition="error_gender"  
> tal:replace="structure
> string:$error_gender <br />" />
>                     <input type="text" name="gender" size="25"  
> tabindex=""
> value="member.gender html_quote" onfocus="formtooltip(gender_help,1)"
> onblur="formtooltip(gender_help,0)" tal:attributes="value gender;  
> tabindex
> tabindex/next;" />
>                 </div>
>             </div>
>
> A good place to do this would be after the closing of the div tag which
> starts like this:
> <div class="field" tal:define="visible_ids ............
> (just search for visible_ids and then scroll down until you see the  
> </div>
> tag)
>
> *********************************************************************** 
> *****
> ***
> Step 3: Look at our sample and then try your own property
> *********************************************************************** 
> *****
> ***
>
> For a sample of what has just been described, go to
> http://www.vasudevaserver.org:7091/Dhyani, log in or join if you are  
> not a
> member yet. Then click on "my preferences" and then on "Personal
> Preferences". Here you see the result. If you want to see the code, go  
> to
> the respective Plone folders as described in Step 1 and Step 2.
>
> Now, if you wanted to have another property called name_of_pet, you  
> would go
> through Step 1 and Step2, first adding the name_of_pet property as  
> described
> in Step 1, then adding the above code to the personalize_form.  
> Obviously,
> you would have to overwrite every occurrence of the string "gender"  
> with the
> string "name_of_pet".
> Good luck!
>
>


--------------------------------------------------------------------------
This message is sent to you because you are subscribed to the mailing list <VasudevaService-K9y3B4ipJAZZAIG4hdpdiNBPR1lH4CV8@public.gmane.org>.