function social_profile_update_8802 in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/social_profile.install \social_profile_update_8802()
- 8.8 modules/social_features/social_profile/social_profile.install \social_profile_update_8802()
- 10.3.x modules/social_features/social_profile/social_profile.install \social_profile_update_8802()
- 10.0.x modules/social_features/social_profile/social_profile.install \social_profile_update_8802()
- 10.2.x modules/social_features/social_profile/social_profile.install \social_profile_update_8802()
Update social_profile.settings config & permissions for authenticated role.
File
- modules/
social_features/ social_profile/ social_profile.install, line 406 - Install, update and uninstall functions for the social_profile module.
Code
function social_profile_update_8802(&$sandbox) {
$config = \Drupal::configFactory()
->getEditable('social_profile.settings');
$config
->set('social_profile_show_language', TRUE);
$config
->save();
// Add permission to view profile language for authenticated role.
$roles = Role::loadMultiple();
$permissions = [
'view profile language',
];
/** @var \Drupal\user\Entity\Role $role */
foreach ($roles as $role) {
if (in_array($role
->id(), [
'sitemanager',
'contentmanager',
])) {
user_role_grant_permissions($role
->id(), $permissions);
}
}
}