Displaying custom attribute in Edit My Profile Portlet + Registration portlet

The User Registration portlet allows new user to sign up or register for the portal. On the login portlet you will see a sign up link and clicking on that link will take you to the User Registration screen



The Edit My Profile portlet allows user to edit value of one or more attributes in his user profile, Once user logs into the portal he should see the Edit My Profile link in the top right corner of the portal page. When you click on that link you will get a screen like this.


If you click on the Edit My Profile link it will take you the screen where you can edit few attributes from your user profile


Important Note Most of the companies dont allow portal to update data in the LDAP. So make sure that your LDAP binding user has right access to the LDAP server

As you can see by default it allows you to edit values for First Name, Last Name, password, Email and Preferred Language fields. You can change the fields that are displayed on the Edit Profile screen to add additional attributes by following these steps

  • I wanted to add testProperty, which is a custom attribute. So first i did add testProperty as ldap attribute by following steps described in Adding new attributes to WebSphere Portal
  • Then i logged in into the WebSPhere Portal with Administrative user and went to Edit My Profile portlet

  • Go to the Edit mode of Edit My profile by clicking on the customize button. In the Edit mode it allows us to define what all attributes you want to display on the Edit My Profile screen + User Registration portlet so check check box next to testProperty and title properties and save



  • Now when you come back to the Edit My profile portlet you should see couple of new fields there.



  • Enter some data in those two fields and click save. In my case i am using Default File based repository so that data gets saved in the wp_profile\config\cells\sunpa\fileRegistry.xml file.

    <wim:entities xsi:type="wim:PersonAccount">
    <wim:identifier externalId="c233f13f-663d-4292-baf0-989e2ef805a4" externalName="uid=wasadmin,o=defaultWIMFileBasedRealm"
    uniqueId="c233f13f-663d-4292-baf0-989e2ef805a4" uniqueName="uid=wasadmin,o=defaultWIMFileBasedRealm"/>
    <wim:parent>
    <wim:identifier uniqueName="o=defaultWIMFileBasedRealm"/>
    </wim:parent>
    <wim:createTimestamp>2008-11-15T19:23:49.811Z</wim:createTimestamp>
    <wim:modifyTimestamp>2009-05-13T09:39:10.787-07:00</wim:modifyTimestamp>
    <wim:password>U0hBLTE6MGdtN3ZsaWJlYmZhOmVkamVHRWp4clRicjVJYmthckMxVzQ1UkZNVT0NCg==</wim:password>
    <wim:uid>wasadmin</wim:uid>
    <wim:cn>wasadmin wasadmin</wim:cn>
    <wim:sn>wasadmin</wim:sn>
    <wim:preferredLanguage>en_US</wim:preferredLanguage>
    <wim:ibm-primaryEmail>wasadmin@us.ibm.com</wim:ibm-primaryEmail>
    <wim:givenName>wasadmin</wim:givenName>
    <wim:testProperty>Test property value</wim:testProperty>
    </wim:entities>

    In my case i changed values for wasadmin user so this is what i see in the fileRegistry.xml after saving my change in the Edit My Profile portlet

  • Now log out of the portal and go the User Registration screen and you should see a screen like this


3 comments:

Unknown said...

This is a brilliant write up, thank you very much.

I have followed:
- adding-new-attribute-to-websphere
- managing-ldap-attributes
successfully, and now am running
- displaying-custom-attribute-in-edit-my

Unfortunately i cannot view these newly created attributes in Edit My Profile > Configure. These same attributes do show up in the attributes report.

Do you have any idea why?

Unknown said...

Oh, to add to that, developers cannot call upon these attributes either.

I have raised this with IBM and am being told they need to be added to a lookaside database - is this correct?

Sunil Patil said...

In my case i dont have a look aside database, i am using a developer install. So when i added a new attribute it was added to the default File based registry and when i made changes to it those changes got saved in fileRegistry.xml.

Check Query Attributes to make sure that newly attribute is actually there. If you see an attribute in that list then it should appear in the Edit Profile custom mode