Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Here is what I got to but it's not working:
if ('group_content_hub-group_membership_edit_form' == $form_id) {
$user = \Drupal::currentUser()->getRoles();
if (in_array("hub_publisher", $user) && !in_array("administrator", $user)) {
$form['group_roles']['widget']['#options']['hub-content_publisher']['#disabled'] = TRUE;
$form['group_roles']['widget']['#options']['hub-hub_admin']['#disabled'] = TRUE;
}
}
I also need to change the core role check to a check for current group role, so any help with the function for that would be appreciated as well.
Comments
Comment #2
realityloop