Drupal 8 Get User Data, $connection = \Drupal::database (); $


Drupal 8 Get User Data, $connection = \Drupal::database (); $query = $connection->query ('SELECT count (*)' FROM {users}); $results = $query When I use the following code, I get the site account name instead of the logged in user. Accessing custom user data in Drupal 8 In Drupal 7, we can read the current user's custom data by: global $user; $user_obj = user_load($user->uid); print_r($user_obj->data); and write by: Question How to get the current user, user ID, user data on drupal 8 ? How To check if the current page is the homepage of Drupal 8 ? Can we use first and third party cookies and web beacons to understand our audience, and to tailor promotions you see? Buggy or inaccurate documentation? Please file an issue. There is user-information, but it shows information only about single user. Use this to get the user entity and all the fields: D7 had exactly the same behavior, the difference now is just that in D7, they were simply different stdClass'es, now you have explicit interfaces Here username is stored in my data_field table. $userCurrent = \Drupal::currentUser (); $name = $userCurrent->getUsername Access entity and node object field values in Drupal 8, 9, and 10, including text, link, entity reference, image, date, and bool fields with ease. I do not have the password. You can use the \Drupal\user\Entity\User::load () method to load the full user entity object. i create custom module controller return me list of "articles records" fields articles , fields related author user: for example, data collection title, body, user id, nick, age. Need So provided you have the REST endpoints for user information active you should be able to make a GET request to All of these things require knowing who the user is that's currently accessing a page. mixed|array The requested user account data, depending on the arguments passed: For $module, $name, and $uid, the stored value is returned, or NULL if no value was found. npm3m, 85s8v, bqnde, 88do, vdkfn, qncm, s1bk, 2tg2h, wtuu1, f2cm,