diff --git a/fantasy-football/sites/all/modules/contrib/masquerade/masquerade.module b/fantasy-football/sites/all/modules/contrib/masquerade/masquerade.module index 12f68fd..39f91f3 100644 --- a/fantasy-football/sites/all/modules/contrib/masquerade/masquerade.module +++ b/fantasy-football/sites/all/modules/contrib/masquerade/masquerade.module @@ -435,17 +435,20 @@ function masquerade_user_view($account, $view_mode, $langcode) { ->fetchCol(); $can_masquerade_as_user = in_array($account->uid, $allowed_uids) || user_access('masquerade as any user'); - if (user_access($perm) && empty($account->masquerading) && $user->uid != $account->uid && $can_masquerade_as_user) { - $account->content['masquerade'] = array( - '#markup' => l(t('Masquerade as !user', array('!user' => $account->name)), - 'masquerade/switch/' . $account->uid, - array('query' => array( - 'token' => drupal_get_token('masquerade/switch/' . $account->uid)), + if (user_access($perm) && empty($account->masquerading) && $user->uid != $account->uid) { + if ($can_masquerade_as_user || _masquerade_user_access($account)) { + + $account->content['masquerade'] = [ + '#markup' => l(t('Masquerade as !user', ['!user' => $account->name]), 'masquerade/switch/' . $account->uid, [ + 'query' => [ + 'token' => drupal_get_token('masquerade/switch/' . $account->uid) + ], 'destination' => $_GET['q'], - 'attributes' => array('class' => array('masquerade-switch')), - )), - '#weight' => 10, - ); + 'attributes' => ['class' => ['masquerade-switch']], + ]), + '#weight' => 10, + ]; + } } }