Forum Discussion
Thanks for your response, luk . Could you please let me know how difficult it would be to implement the functionality to create an anonymous user and allow posts to be published on their behalf? We do not need deep anonymity; simply hiding the author's email and nickname will suffice. Where can I find an example of the default functionality for publishing a post at the endpoint, or does it need to be developed using the API?
- luk5 months agoBoss
Could you please let me know how difficult it would be to implement the functionality to create an anonymous user and allow posts to be published on their behalf?
A "global" Anon user can simply be created via Admin > Users > Create User, that user then has a login, e.g. "Anonymous" or whatever, give it the permission to switch users, then you can use API v1 in the endpoint you'd send the anon post to: https://devdocportal.khoros.com/t5/Community-API-v1-Reference/bd-p/restv1docs?section=commv1&leaf-id=AuthenticationManager.sessions.login#AuthenticationManager.sessions.login to get a session token for that anon user which you post with.
Then use either API v1 or v2 to create that anon post: https://devdocportal.khoros.com/t5/Community-API-v1-Reference/bd-p/restv1docs?section=commv1&leaf-id=Board.messages.post#Board.messages.post or https://developer.khoros.com/khoroscommunitydevdocs/reference/create-a-message considering tricky stuff like images and attachments as well... as Akenefick said, that's problematic because those files are uploaded on the post page BEFORE the content is posted and are therefore already linked to the original user (technically) and if you want to be really serious about the anon stuff, those should be re-uploaded to the anon user's account, which can't be done in freemarker...e.g. you can't download a file in FreeMarker...afaik. So you'd have to figure out if you can somehow intercept those uploads and do them to the Anon-account instead, which might also be a problem because depending on where that anon-switch is on the post page, the user might not have activated that yet, so the post page wouldn't even know that it should intercept those uploads until it's already too late, e.g. if the files are uploaded first when creating the post and THEN the user activates the "Post anonymously" switch, it won't work properly... (if it can then even be done 😉)...I'd estimate at least 3-5 days of work (finger in the wind...).We do not need deep anonymity; simply hiding the author's email and nickname will suffice.
Well, noone can see the author's email if they are not an admin anyways, and if just the username/nickname in the frontend/UI should be "Anonymous" instead of the actual username, that would certainly be much easier, but as I wrote above, anyone remotely familiar with the API could simply find the original author by asking the API for the specific post in question and the API would just spit out the original author's public data... but also with this there would be things to consider: Like activity feeds on the profile page which would also need to be "anonymized" on the UI side and probably many more places you are not thinking about now that will then accidentally show the real username instead of the Anonymous one...
Where can I find an example of the default functionality for publishing a post at the endpoint, or does it need to be developed using the API?
yes that definitely requires custom posting via the API
Considering all of this and the issues mentioned by Akenefick above, it might even be reasonable to try and completely replace the forum post page with a custom form that always posts to a custom endpoint and creates posts via the API...but that's a whole other rabbit hole to go down!
Related Content
- 9 months ago
- 2 years ago
- 2 years ago