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;
                user.Profile.SetCustomProperty("CustomPropertyName", "CustomPropertyValue");


You need to add the following configurations in your include folder

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="">
      <event name="social:connector:user:created">
        <handler type="Sitecore.SharedSource.Events.Social.UserCreated, Sitecore.SharedSource" method="UpdateUserProfile"/>

Hope this helps!


Popular posts from this blog

Attaching a file on WFFM Send email action

Caching Rendering HTML when conditional rules are applied

Set Workflow using Item Buckets Search Operations