Plone5 增加用户属性

Plone5 增加用户属性

Plone5用户注册模块为plone.app.users,这个模块支持采用GenericSetup方式增加用户属性,用userschema.xml:

  • 增加注册表单用户属性:
<model xmlns="http://namespaces.plone.org/supermodel/schema"
       xmlns:form="http://namespaces.plone.org/supermodel/form"
       xmlns:users="http://namespaces.plone.org/supermodel/users"
       xmlns:i18n="http://xml.zope.org/namespaces/i18n"
       i18n:domain="plone">
    <schema name="member-fields">
    <field name="safe_level" type="zope.schema.Choice" users:forms="On Registration">
      <description/>
      <required>False</required>
      <title i18n:translate="">safe level</title>
      <vocabulary>tl.safe_level</vocabulary>
    </field>
</schema>
</model>
  

  • 增加用户属性表单属性
<model xmlns="http://namespaces.plone.org/supermodel/schema"
       xmlns:form="http://namespaces.plone.org/supermodel/form"
       xmlns:users="http://namespaces.plone.org/supermodel/users"
       xmlns:i18n="http://xml.zope.org/namespaces/i18n"
       i18n:domain="plone">
  <schema name="member-fields">
    <field name="home_page" type="zope.schema.URI"
      users:forms="In User Profile">
      <description i18n:translate="help_homepage">
          The URL for your external home page, if you have one.
      </description>
      <required>False</required>
      <title i18n:translate="label_homepage">Home page</title>
    </field>
</schema>
</model>
设置