Example - Editing partner profiles

In this example, you will create a list of business partners who will be able to edit their profile on the My profile page after they have signed in. This example assumes that you are using the sample Corporate Site.

Creating the Partner profile page type

The Partner profile page type will store the name and text description of the partner.

  1. Open the Page types application.

  2. Click New page type.

  3. In Step 1 of the New page type wizard, enter the following, then click Next:

    • Page type display name: Partner profile
    • Namespace: custom
    • Name: PartnerProfile

    Step 1 of the New page type wizard

  4. In Step 2, leave the default values and click Next.

  5. In Step 3, add two attributes to the page type using the New field and Save buttons:

    • Partner name field
      • Field name: PartnerName
      • Field type: Text
      • Required: yes
      • Field caption: Partner name
      • Form control: Text box
    • Partner profile field
      • Field name: PartnerProfile
      • Field type: Long text
      • Field caption: Partner profile
      • Form control: Rich text editor

    Adding fields to the page type

  6. Click Next.

  7. In Step 4, select PartnerName in Page name source.

  8. Click Next in each of the remaining steps to finish the process.

The system creates a new page type named Partner profile.

Creating the partner list page

The partner list page will display a list of partner profile pages.

  1. Open the Pages application.

  2. Select the Examples page.

  3. Click New () and select the Page (menu item) page type.

  4. Type Partner directory as the Page name, select Create a blank page and click Save.

    Creating a new blank page

  5. Switch to the Design tab and add the Repeater web part to the page.

  6. Set the following repeater properties:

    • ID: repeaterPartners
    • Page types: custom.PartnerProfile
    • Transformation: custom.PartnerProfile.Default
    • Selected item transformation: custom.PartnerProfile.Default
  7. Click Save & Close.

The system creates a page which will display a list of partner profile pages.

Creating the partner user account

Now create a sample user which we will use in the examples.

  1. Open the Users application.

  2. Create a new user with the user name AAAWebDesign.

  3. Set the user’s Privilege level to None.

    Creating the sample AAAWebDesign user

  4. Click Save.

  5. Switch to the Roles tab and add the user to CMS Basic users.

You have created a user whose partner portal page you will create in the following procedure.

Creating the partner profile page

  1. Open the Pages application.

  2. Select the Examples -> Partner directory page.

  3. Click New () and select the Partner profile type.

  4. Enter the following information and click Save:

    • Partner name: AAA Web Design Inc.
    • Partner profile: We provide web development services.

    Creating a new page of the Partner profile type

  5. Open the Properties -> URLs tab.

  6. Set the Page alias to AAAWebDesign and click Save.

    • You need to use the same alias as the user name since you will be using them to match the users to their user profiles.
    • The alias path of the page will always be /Examples/Partner-directory/<user name>.

When you display the page in Preview mode now, you will see a page similar to this:

Previewing the partner page

Creating the partner profile editing page

Now you will create a page that will be available only to partners and that will allow them to edit their partner profile.

  1. Open the Pages application.

  2. Select the Examples page.

  3. Click New () and select the Page (menu item) type.

  4. Type My profile, choose the Create a blank page option and click Save.

    Creating a new page for editing partner profiles

  5. Switch to the Design tab of the newly created page and add the Repeater web part.

    • The repeater will display the current user’s partner profile.
  6. Set the following properties for the repeater and click Save & Close.

    • ID: repeaterPartners
    • Path: /Examples/Partner-directory/{%CurrentUser.UserName#%}
      • This ensures that the page displays the profile that matches the current user.
      • The {%CurrentUser.UserName#%} macro is resolved as the user name of the current site visitor.
    • Page types:custom.PartnerProfile
    • Transformation: custom.PartnerProfile.Default
    • Selected item transformation: custom.PartnerProfile.Default
    • Hide if no record found: no (clear the check-box)
    • No record found text: No partner profile was found for your user account.
    • Content before: <h1>Your Partner Profile</h1>
  7. Add the User contributions/Edit contribution web part, set the following properties for the web part and click Save & Close.

    • Path:/Examples/Partner-directory/{%CurrentUser.UserName#%}
      • This ensures that the form edits a profile matching the current user.
      • The {%CurrentUser.UserName#%} macro is resolved as the user name of the current site visitor.
    • Allow delete: no (clear the check box)
      • This option hides the Delete button as you don’t want the partners to delete their profile accidentally.
    • Allow editing by users: Authenticated
      • You want to allow editing only to authenticated users. At the same time, you don’t require the user to be a page owner.
  8. Open the Properties -> Security tab.

  9. Set the Requires authentication value to Yes and click Save.

    • This will enable access to this page only to the authenticated partners so that you know their user name for displaying their profile.

You have created a page that will allow the partners to edit their profiles.

Testing the profile editing page

  1. Sign out and go to Examples -> My profile page (you can find a link at the bottom of the page).

    • The system displays a logon form.
  2. Sign in as user AAAWebDesign and you will see your partner profile with the Edit link.

    Viewing the partner profile

  3. Click Edit to open the edit dialog window,modify some values and click Save.
    Editing the partner profile

  4. Go to Examples -> Partner directory pageand you will see the updated profile.

    Edited partner profile

Hint 1: Simplifying the process of creating a new partner

You can develop a custom page (see Custom development) containing a form for creating new partners, including code that automatically creates user accounts and partner profile pages with a corresponding alias path.

Hint 2: Assigning multiple users to the same partner profile

If the user name/page alias path mapping does not fit your needs or if you need to assign multiple users to the same partner profile, you can use another option:

  1. Open the Modules application.
  2. Edit the Membership module.
  3. Open the Classes tab and edit the User class.
  4. On the Fields tab, create a custom text field for users, for example named PartnerProfileAliasPath.

You can then use the custom field to specify which pages users can edit as partner profiles. Set the Path property of the Edit contribution web part using a matching macro expression, such as {% CurrentUser.PartnerProfileAliasPath %}.

Note: When configuring user accounts, you can find custom fields on the Custom fields tab.