Add-on Hide Usernames/Details Beside Posts for Specific User Groups

himmelman

Member
I’m looking for an add-on or a solution to hide usernames and profile details (like banners or user groups) displayed beside posts for guests or specific user groups. The goal is to enhance privacy and encourage users to sign in or register by not revealing who posted a message unless they’re logged in.

For example, guests would only see the post content without any identifying details about the poster, while signed-in users could see the full profile information as usual.
 
I would think the quickest hack would be simply to modify the templates to only output the user-info section if the viewer was logged in, ie popping something like:
Code:
<xf:if is="$xf.visitor.user_id">
   <!-- stuff only logged in users should see -->
</xf:if>
You'd have to dig around a bit (or wait for someone here with a better memory than me) to locate which template will have the (probably) macro that renders the user panel by each post.

You'd probably also want to make sure profiles and so forth were only visible to logged in users (although users can set those permissions themselves)
 
thanks @chillibear

I want this for the inactive users. I have no issue with inactive users being able to see the member list or profiles, but I want to ensure privacy by hiding who posted specific messages on the forum.
 
What do you mean by inactive? Do you mean those not logged in (ie guests) or something else?

If it's guests who you want to hide some stuff from then that's what the above if statement would do. Wrap it around something that spits out user information and that information will only be shown to a logged in user. If you do want something more complicated then probably better off hunting for an add-on that would have tighter integration than a quick template hack.

Looks like it's probably the message_macros template for the main post pages, but of course there are loads of places where avatars and usernames are given. So thread lists show them, you have Reactions that give usernames, new post lists, search results, probably many more. How much tweaking would depend how far you wanted to go, but the danger is it becomes a bit of a rabbit hole! Still you can probably safely have a little play to see what it could end up looking like.

I guess an add-on might be able to knobble the actual template tags that return the username and avatar details (eg <xf:username> and <xf:avatar>) so they only returned the actual data when the caller was logged in. Afraid I don't know enough about XF's architecture to know how easy/hard that might be. Still plenty of talented add-on developers here who do know!
 
Back
Top Bottom