Commit 01e81ee0 authored by Kevin Paxman's avatar Kevin Paxman Committed by Roger Codina
Browse files

Issue #3245828: Show all roles on profile, not just those that expire

parent e8824421
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -285,9 +285,13 @@ function role_expire_user_view(&$build, $entity, $display, $view_mode) {
      // 1. Gather all role expiration information.
      $roles = [];
      $expiry_roles = \Drupal::service('role_expire.api')->getAllUserRecords($account->id());
      $role_names = user_role_names();
      foreach (($account->getRoles()) as $rid) {
        if (array_key_exists($rid, $expiry_roles)) {
          $roles[] = t("%role role expiration date: %timedate", ['%role' => ucfirst($rid), '%timedate' => \Drupal::service('date.formatter')->format($expiry_roles[$rid])]);
          $roles[] = t("%role role expiration date: %timedate", ['%role' => $role_names[$rid], '%timedate' => \Drupal::service('date.formatter')->format($expiry_roles[$rid])]);
        }
        else {
          $roles[] = t("%role role (no expiration)", ['%role' => $role_names[$rid]]);
        }
      }

@@ -296,7 +300,7 @@ function role_expire_user_view(&$build, $entity, $display, $view_mode) {
        $build['role_expire'] = [
          '#theme' => 'item_list',
          '#items' => $roles,
          '#title' => t('Role expiration'),
          '#title' => t('Roles'),
          '#attributes' => ['class' => ['role-expiry-roles']],
          '#weight' => 1000,
        ];