Auto populate custom userid identifier field on user creation

סיכום מבוסס בינה מלאכותית

tc3driver is seeking a way to auto-populate a custom user field with the user ID during account creation, but has found no existing solutions across search engines or forums. They propose a workaround using a webhook to a PHP script that accesses the PostgreSQL database directly, as they prefer PHP over Ruby and want to avoid user-manipulated data. They explain the need for reliable user ID tracking in their gaming community for administrative and progression purposes. itsbhanusharma suggests using the Office365 authentication plugin if applicable or exploring the Discourse Data Explorer plugin for database access, but acknowledges the need for a custom plugin solution.

I have searched and searched … then searched some more… google … no love, duck duck go … nope, even bing (yes I tried it because I was out of options)… not a chance, these forums… no…

So what I am looking to do is have a custom field populated with the user’s user id, (users.id in the database). As stated above I have been searching around for a few days now and have come across no solutions. I just want to make sure that I am not missing anything before I invent the wheel on this one (no it will not be a ruby solution, as to say that I am a novice at ruby would be kind).

The solution that I am thinking about uses a webhook into a php script running on the same server, with the pgsql database exposed on the lo interface. From the information provided in the webhook I should be able to populate that data in the custom field via php script.

To stem the “why would you want to do that?” questions, firstly the user ID is tracked on forms and spreadsheets for part of our user management and tracking (we are a gaming community and we use it to track hours and user progression), that ID is central to this tracking methodology. Second I am an old-school admin, and most would tell you to never trust a user, I fall into that same track. Give them something they can look up in their profile, great, have them populate that field and trust it is populated with the correct information… yeah not so much. As for the php side of things, well I am just more comfortable over there, and it makes more sense with the webhook approach.

I am open to different ideas on how to accomplish this task, as I am sure that there is a far more efficient way to do so, even if it means learning ruby in the long term.

Thanks for any information you all can provide :slight_smile:
I hope you fine folks have a great one :smile:

If You’re using office365 or something, There is
https://github.com/discourse/discourse-plugin-office365-auth
Which will authenticate the users with their existing office365 credentials.

If it is something else, You’re looking into a plugin territory. to get values from the database, Maybe try using:
https://github.com/discourse/discourse-data-explorer