Updating Sitecore Social Connected Module 2.1


The problem

Check this post before you start with this one, so you can have an idea of what is the problem.

In short, this module uses deprecated facebook keys, and these keys are hardcoded in the DLLs of this application.

This is not a problem with the socially connected module. It is caused by changes in these social networks' APIs.

The solution

  1. Use any .net reflector, open Sitecore.Socail.Facebook.Dll, create a project from the source code.
  2. Fix the errors in the project by adding the required references and rebuild the project.
  3. Go to this function GetAccountBasicData in FacebookProvider.cs
  4. Remove the code inside the function, and add the following code instead.
    string item; 
    Assert.IsNotNull(account, "Account parameter is null");
    IDictionary<string, object> accountData = this.GetAccountData(account, "/me");
    if (accountData == null)
    {
        return null;
    }
    string str = string.Concat(accountData["name"]);
    AccountBasicData accountBasicDatum = new AccountBasicData()
    {
        Account = account,
        Id = accountData["id"] as string
    };
    AccountBasicData accountBasicDatum1 = accountBasicDatum;
    if (accountData.ContainsKey("email"))
    {
        item = accountData["email"] as string;
    }
    else
    {
        item = null;
    }
    accountBasicDatum1.Email = item;
    accountBasicDatum.FullName = str;
    return accountBasicDatum;

Subscribe to Ahmad Harb

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe