1

Ours is a multisite instance running on sc8.0 update 5.
A user record is auto created when visitor logs in using the Social connector, and I need to prevent that for a particular site.

This is what I did.

custom.config:

<sitecore>
 <pipelines>
  <httpRequestBegin>
   <processor patch:instead="processor[@type='Sitecore.Social.Connector.Pipelines.MatchUser.CreateUser, Sitecore.Social']"
              type="MySite.Foundation.Common.Utilities.SitecoreExtensions+MySiteSocial, MySite.Foundation.Common">
     <sites hint="list">
      <site>MYSITE</site>            
     </sites>
   </processor>
  </httpRequestBegin>
 </pipelines>
</sitecore>

SitecoreExtensions.cs

public class SitecoreExtensions
{
  public class MysiteSocial : HttpRequestProcessor
  {
    public List<string> Sites { get; set; }

    public MysiteSocial()
    {
      Sites = new List<string>();
    }

    public override void Process(HttpRequestArgs args)
    {
      if (Sites.Contains(Sitecore.Context.Site.Name))
        return;      
    }
  }
}

The user is still getting created. How can I go about achieving what I need.

1
  • 1
    you might have to override the Createuser pipeline , to disable user creation on FB login <social.matchUser> ... <processor type="Sitecore.Social.Connector.Pipelines.MatchUser.CreateUser, Sitecore.Social" /> </social.matchUser> – Abhay Dhar Mar 16 '17 at 14:57
4

Your configuration is targeting the wrong pipeline, by default the Social CreateUser method is in the social.matchUser pipeline but your config specifies httpRequestBegin.

I would also suggest patching a new processor first and then aborting the pipeline if it meets your criteria:

public class SitecoreExtensions
{
    public class MySiteSocial
    {
        public List<string> Sites { get; set; }

        public MysiteSocial()
        {
            Sites = new List<string>();
        }

        public void Process(SelectUserPipelineArgs args)
        {
            if (Sites.Contains(Sitecore.Context.Site.Name))
                args.Abort();
        }
    }
}

And the associated config patch to add this as the first processor in the correct pipeline:

<sitecore>
 <pipelines>
  <social.matchUser>
   <processor type="MySite.Foundation.Common.Utilities.SitecoreExtensions.MySiteSocial, MySite.Foundation.Common" patch:before="*[1]">
     <sites hint="list">
      <site>MYSITE</site>            
     </sites>
   </processor>
  </social.matchUser>
 </pipelines>
</sitecore>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.