Username issues

Created on 27 April 2025, 19 days ago

As mentioned in a previous issue. This login stores the user's steamid as their website display name. In my case where the steam login is the only means of registration and depends on steam ID and Display name I need it to assign the steam name directly as the website name. Example shown below

Default code:

    $userInfos = [
      'name' => "steam-$steamCommunityId",
      'pass' => '',
      'status' => 1,
      'field_steam64id' => $steamCommunityId,
      'field_steam_username' => urlencode($steamNickname),
    ];

My adjustments:

  $userInfos = [
    'name' => $steamNickname,
    'pass' => '',
    'status' => 1,
    'field_steam64id' => $steamCommunityId,
    'field_steam_username' => $steamNickname,
    'field_steam_avatar' => $avatarUrl, // Store avatar URL in custom field (not part of this fix)
  ];

ALSO, steam Web API passes the steam names as a plain text array so using "urlencode()" will break special symbols thinking it is code references. You can pass the steam names through without encoding so names with special symbols can show correctly.

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @machin3
  • 🇫🇷France MacSim

    My first thought is we should introduce a hook so you can alter the data before the user is saved and right after $userInfos has been built.
    This would allow you to add this field_steam_avatar which is provided on your side and is not part of the module.

    About urlencode(), I have to make new tests ; last time I did, my steam nickname was sent as Re|&lt;oNe instead of Re|<oNe

  • About urlencode(), I have to make new tests ; last time I did, my steam nickname was sent as Re|<oNe instead of Re|

    That is how it turned out for my name with the bio symbols using urlencode(). I believe steam altered the output because of this issue with external databases not reading names correctly. I have this issue still with game mods sending out usernames to external systems and they don't understand each other. The plain text format steam is now using is much better with that.

    The steam avatar one is kinda rigged in at the moment as I used a link type as I wasn't sure how I was going to be able to get that information. Then I had to come up with a decode function to strip Drupals auto link format so I can use just the URL. A simple text field would have been much easier.

Production build 0.71.5 2024