Example: Editing partner profile |
In this example, we will create a list of partners where partners can edit their profile on the My profile page after they sign in. This example assumes you're using the Corporate Site sample web site.
Creating the partner document type
Before we create the page, we need to create a new document type Partner. Sign in as administrator to CMS Site Manager and go to Development -> Document types.
Click New document type and enter the following values:
Step 1: General
Step 2: Data type Choose the option "The document type has custom fields" and set:
Step 3: Fields Create the following fields:
Step 4: Additional Settings
Step 5: Parent types
Choose only Page (menu item).
Step 6: Sites
Choose your current web site.
Creating the partner list
Go to CMS Desk -> Content, click Examples and click New. Choose to create a new Page (menu item) document. Call the page Partner directory and choose the Create a blank page using this layout option. Choose the Simple layout and click Save.
Switch to the Design tab of the newly created page and add the Listings and viewers/Repeater web part. Set the following properties:
Please note: we will use the default transformation generated by the system, you can later modify the transformation so that it meets your design and layout requirements.
Click OK. Switch to the Page view and you will see an empty page now.
Creating the partner user account
Go to CMS Desk -> Administration -> Users and create a new user with user name AAAWebDesign. Set the Is editor property to no (unchecked).
Creating the partner profile document
Go to CMS Desk -> Content, click /Examples/Partner directory and click New. Choose to create a new Partner. Enter the following values:
Click Save. Go to Properties -> General and set the Document alias to AAAWebDesign and click Save. We need to use the same alias as the user name since we will be using them to match the users to their user profiles. The alias path of the document will always be /Examples/Partner-directory/<user name>.
When you see the page in the Live site mode now, you will see a page like this:
Creating the partner profile editing page
Now we will create a page that will be available only for partners and it will allow them to edit their partner profile. Choose the /Examples document in the content tree and click New. Choose to create a new Page (menu item). Call the page My profile and choose the Create a blank page using this layout option. Choose the Simple layout and click Save.
Switch to the Design tab of the newly created page and add the Listings and viewers/Repeater web part. It will display the current user's partner profile. Set the following properties and click OK.
Add the User contributions/Edit contribution web part. Set the following values:
Go to the Properties -> Security dialog, set the Requires authentication value to Yes and click OK- we want to allow the access to this page only to authenticated partners so that we know their user name and can display their profile.
Testing the profile editing page
Sign out and go to Examples -> My profile. You will be displayed with logon form. Sign in as user AAAWebDesign. You will see your partner profile with Edit button:
Click Edit, modify some values and click Save:
Go to Examples -> Partner directory and you will see the updated profile:
In this example, you have seen how you can allow users (partners) to edit a single document that matches their user name. It was a little different to the previous example (Example: Publishing community news), since in this case, we have created the document first and then we mapped it to the user by matching the document alias path and user name. The partner wasn't allowed to create new documents in this example and we didn't use the "document owner" security option.
|