CRM-12695 fixes and web test for the same.

----------------------------------------
* CRM-12695: Membership sharing doesn't work after merge
  http://issues.civicrm.org/jira/browse/CRM-12695
* CRM-12695-1:
  http://issues.civicrm.org/jira/browse/CRM-12695-1