Attention

This document was written for an old version of Plone, Plone 3, and was last updated 797 days ago.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Adding Memberdata properties (as a select list)

by Espen Moe-Nilssen last modified Mar 17, 2010 10:09 AM
Usercase: I had a site where everybody that joined should get a t-shirt. The T-shirts sizes might change later so be nice if it was OK to do this TTW
Add the property: 
1) The property (tskjorte) has to be added to http://yoursite/portal_memberdata You probably want to add this as a string: 
 
2) We want somewhere to store the selections (sizes in this case) that should be avalable. http://yoursite/portal_properties is a good place for this:
 
 

Bilde 1

 

Added property sheet (button on the right). I called it "kuliaden_properties" 
( In case you wonder: the "memberdataexport_properties came from product "Memberdata csv exporter" that I use for exporting a list of members / t-shirt sizes etc. )
 
3) Add a property. Chose Type: Lines
 
Bilde 2
 
4) Customize the join_form, you find it in http://yoursite/portal_skins/plone_login
    and add the following lines:
______________________________________________________________________
  
      <div class="field">
      <label for="tskjorte" i18n:translate="label_tskjorte">T-skjorte</label>
  <span class="fieldRequired" title="Required"
                                  i18n:attributes="title title_required;"
                                  i18n:translate="label_required">(Required)</span>
          <div class="formHelp" i18n:translate="help_tskjorte">
          Velg hstørrelse
          </div>
 
          <select name="tskjorte"
                  id="tskjorte'">
                  <tal:block tal:repeat="skjorte portal_properties/kuliaden_properties/tskjorte">
                  <option tal:condition="python:skjorte != 'None'"
                   value="None"
                   tal:attributes="value skjorte;"
                   tal:content="skjorte">
                   some text
                   </option>                              
                   </tal:block>
            </select>
      </div>

______________________________________________________________________
 
Just after email (see screenshot)


Bilde 3

 

 

5) Customize the personalize_form. For some reason (?) you find it at http:/yoursite/portal_skins/plone_prefs/personalize_form 
    Add the following text:
______________________________________________________________________
 
      <div class="field"
                                 tal:define="tskjorte python:request.get('tskjorte',
                                                            member.getProperty('tskjorte',''))">
                            <label for="tskjorte" i18n:translate="label_tskjorte">T-skjorte størrelse</label>
         <span class="fieldRequired" title="Required"
                                  i18n:attributes="title title_required;"
                                  i18n:translate="label_required">(Required)</span>
 
                             <div class="formHelp" i18n:translate="help_tskjorte">
                             Velg størrelse på T-skjorten
                             </div>
 
                            <select name="tskjorte"
                                    id="tskjorte"
                                    tal:attributes="disabled python:member.canWriteProperty('tskjorte') and default or 'disabled'">
                                <tal:block tal:repeat="skjorte portal_properties/kuliaden_properties/tskjorte">
                                <option tal:condition="python:skjorte != 'None'"
                                        value="None"
                                        tal:attributes="value skjorte;
                                                        selected python:test(skjorte==tskjorte, 'selected', None);"
                                        tal:content="skjorte">
                                some text
                                </option>
                                
                                </tal:block>
                             </select>
                         </div>
_______________________________________________________________________________________

(see screenshot)
 
 
Bilde 4
 
 
______________________________________________________________________
 
There will be a "top_macro" error. Dont worry about this, its normal (!)
 
6. Hopefully, it should now work   
 
______________________________________________________________________
 
Bilde 5


 

 


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.