New answers tagged

0

It worked in Drupal 8 use Symfony\Component\HttpFoundation\RedirectResponse; function YOUR_MODULE_user_update($account) { $uid = \Drupal::currentUser()->id(); $url = '/u/' . $uid; $response = new RedirectResponse($url); $request = \Drupal::request(); $request->getSession()->save(); $response->prepare($request); \Drupal::service('...


1

I think you're asking, "How can I create a translated string 'Send a private message to @username' where @username is replaced with the name of the user currently being viewed?" If you're viewing the user's page, you can do this like: // Get the user object currently being viewed from the route parameters. $user = \Drupal::routeMatch()->...


0

The Allowed Languages module makes it possible to set restrictions on which content a user can edit based on language. https://www.drupal.org/project/allowed_languages Once installed against each user profile you can check which languages the user can edit as shown below.


0

This issue appears to have been resolved in: https://www.drupal.org/node/2598038 which was merged into core as of 8.1.4. In order to preserve pre-hashed passwords, add the following to your migration YAML file: destination: plugin: entity:user pre_hashed: true


2

If you have the user entity, it's already loaded, and you can get the ID from it. Drupal 7 $user->uid Drupal 8 and later $user->id()


Top 50 recent answers are included