The effects of alcohol on
sustanon 250 leucine for β real weight loss & bodybuilding benefits?
Limited Support
Our support team is currently on holiday from December 25, 2025 to January 7, 2026, and replies may be delayed during this period.
We appreciate your patience and understanding while our team is away. Thank you for being part of the wpDiscuz community!
Merry Christmas and Happy Holidays! π
[Solved] How to treat logged in users as guest?
How-to and Troubleshooting
(@cortega)
Active Member
Joined: 5 years ago
I have a weird request, and don't know where to go in the code to make this happen.
How can I have all users treated as a guest, when they post a comment, so they are allowed to choose their own name, and e-mail at the time of posting something?
Thanks for the help.
(@orakel)
Estimable Member
Joined: 5 years ago
IsnΒ΄t somethink like "dont allow registration"?
(@cortega)
Joined: 5 years ago
Active Member
Posts: 9
Dec 02, 2020 10:38 pm
IsnΒ΄t somethink like "dont allow registration"?
Not sure what you mean ?
Trying to basically get the form, that in the file Form.php is labled under classname ".wpd-form-foot" to always show up, and actually work. I can get it to show up, when someone is logged in, but filling it out and submitting it doesn't actually display the selected name.
Β
Basically trying to make everyone in the comments anonymous, while they are logged in.Β
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8204
Dec 03, 2020 9:12 am
@cortega,
We're really sorry, but wpDiscuz doesn't show the name and email fields if the user is already logged in. There is no way to do it.Β
Basically trying to make everyone in the comments anonymous, while they are logged in.Β
In case if you want to make all comments made by both registered users' and guests as anonymous, let us know. We'll provide you a JS code that will replace the names of the commenters with "Anonymous" phrase.
Β
(@cortega)
Joined: 5 years ago
Active Member
Posts: 9
Dec 03, 2020 4:17 pm
@asti Sure! I think I can make that work. Thanks for the help.
If I figure a solution out I'll post it here, in case someone in the future needs this. I seem to be making some progress using the "preprocess_comment" filter.
Β
(@cortega)
Joined: 5 years ago
Active Member
Posts: 9
Dec 03, 2020 4:24 pm
Actually I forgot I wrote this yesterday. Here is some code that makes users post as anonymous unless they have a certain role. Hopefully it helps someone in the future.Β
Β
add_filter("wpdiscuz_comment_author",Β functionΒ ($authorName,Β $comment)Β {
Β Β Β Β $allowed_rolesΒ =Β array('editor','administrator','author','superΒ admin');
Β Β Β Β $user_idΒ Β Β =Β $comment->user_id;
Β Β Β Β $user_rolesΒ =Β get_userdata($user_id);
Β Β Β Β if(is_object($user_roles)){
Β Β Β Β Β Β Β Β if(!array_intersect($user_roles->roles,Β $allowed_roles)){
Β Β Β Β Β Β Β Β Β Β Β Β $authorNameΒ =Β 'Anonymous';
Β Β Β Β Β Β Β Β }
Β Β Β Β }
Β Β Β Β returnΒ $authorName;
},Β 10,Β 2);
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8204
Dec 04, 2020 7:41 am
Thank you for taking a time and share the solution We really appreciate it.
(@orakel)
Estimable Member
Joined: 5 years ago
Basically trying to make everyone in the comments anonymous, while they are logged in.Β
Ah ok, i understand now.....sorry for the mistake...i will look if i have a simple code for that. Asti helps me so much and sent me a lot of codes.
Maybe he is faster, but i try =)
(@orakel)
Estimable Member
Joined: 5 years ago
I cant find a code at the moment, but i am sure, this would be 2 or 3 lines to rename all roles to "guest" and remove the labels.
Sorry, i am sure Asti will help fast
Β
Orakel
(@cortega)
Joined: 5 years ago
Active Member
Posts: 9
Dec 03, 2020 4:18 pm
@orakel You're fine. I really appreciate you trying to help. Have a great one!