2.1.7. Profile contact provider

Forum and FAQ applications are to show some information about posters. The way to retrieve that information is pluggable through the ContactProvider component.

For public internet websites, users can provide personal information, such as personal email address and location. To enable, simply override the ContactProvider component in your configuration.


Configure the profile-configuration.xml file as shown below:

  <!-- <type>org.exoplatform.forum.common.user.DefaultContactProvider</type> -->

Use ContactProvider

You can get the ContactProvider as follows:

public static CommonContact getPersonalContact(String userId) {

  try {
    if(userId.indexOf(Utils.DELETED) > 0) return new CommonContact();
    ContactProvider provider = (ContactProvider) PortalContainer.getComponent(ContactProvider.class) ;
    return provider.getCommonContact(userId);
  } catch (Exception e) {
    return new CommonContact();


In eXo Platform, when using ContactProvider, you can use the SocialContactProvider classes which gets users' profiles by userId via the IdentityManager class.

public CommonContact getCommonContact(String userId) {

  CommonContact contact = new CommonContact();
  try {
    IdentityManager identityM = (IdentityManager) PortalContainer.getInstance().getComponentInstanceOfType(IdentityManager.class);
    Identity userIdentity = identityM.getIdentity(OrganizationIdentityProvider.NAME, userId, true);
    Profile profile = userIdentity.getProfile();
    if (profile.contains(Profile.EMAIL)) {
    if (profile.contains(Profile.FIRST_NAME)) {
    if (profile.contains(Profile.LAST_NAME)) {
    if (profile.contains(Profile.GENDER)) {
    if (profile.contains(Profile.CONTACT_PHONES)) {
    if (profile.contains(Profile.URL)) {
  } catch (Exception e) {
    if (LOG.isErrorEnabled()) LOG.error(String.format("can not load contact from eXo Social Profile with user [%s]", userId), e);
  return contact;
Name Type Description
email String Email of user.
firstName String First name of user.
lastName String Last name of user.
Attribute Type Description
user.other-info.avatar.url String The path containing the user's avatar.
user.bdate String The user's birthday.
user.home-info.postal.city String The home city of user.
user.home-info.postal.country String The home country of user.
user.gender String The user's gender.
user.jobtitle String The user's job.
user.home-info.telecom.telephone.number String The home phone number of user.
user.business-info.telecom. telephone.number String The mobile number of user.
user.home-info.online.uri String The individual websites of user.
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus