Posts

Showing posts from March, 2015

Adding custom properties to Social Connected users profile

Social Connected module gives the ability for website users to register through their social networks, like Facebook, Twitter, Linkedin and Google+, the module does a good job of mapping users data from these networks and add them to user profile in sitecore.

Recently, we needed to add our own custom properties into users registered through Social networks, i was able to do this by using [social:connector:user:created] event.

The following code grabs the user object from event parameters, and update the profile with our own custom property:

namespace Sitecore.SharedSource.Events.Social {     public class UserCreated     {         protected void UpdateUserProfile(object sender,  EventArgs args)         {             var user = Sitecore.Events.Event.ExtractParameter(args, 0) as Sitecore.Security.Accounts.User;             if(user!=null)             {                 user.Profile.SetCustomProperty("CustomPropertyName", "CustomPropertyValue");                          …