Custom user field that’s hidden from user and editable by API?

is there any way to have a custom user field that is able to be edited through the api, that isn’t displayed anywhere to the user, and is in no way editable by the user?

2 Likes

I think that you’d make it not required at signup, hide it from the signup page with CSS and have it not be editable after signup. You could then edit it with an admin API key.

If the risk that a user might contrive to find the hidden field at account creation time then you’d need a plugin, I think.

Saying more about what you’re actually trying to do might be of use here. You’re proposing a solution here, and not the problem that it’s solving.

2 Likes

It’s not the perfect fit, but could you utilise the User Notes plugin?

2 Likes

I plan to use this to store the user’s computer’s hardware identifier, so users can’t login to another user’s account on the software (which is tied deeply into the forum). And I don’t want them to be able to see it (as it might give something away, not fully sure.) and I don’t want them to be able to change it so they can trick the system into allowing them to login into someone else’s account.

this would require me to manually enter one for each user, no?

I don’t quite understand how you’d do that, but you might check out DiscourseConnect to solve that problem. Or perhaps a custom plugin (if you’re self-hosted or on Enterprise) is what you’d want.

You could populate the User Note with the API the same as what you’d do with the API.

“You could populate the User Note with the API the same as what you’d do with the API.” - I was mainly asking if it would require me to like, create a note for each user. Also I already have a functioning implementation of the hardware identifier thing, I just need a way to store it and associate it with a user. And I know that you can get any user fields just by logging in as the user through the api.