1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

question - how to hide a custom usergroup's posts from unregistered visitors

Discussion in 'Styling and Customization Questions' started by Matt777, May 11, 2012.

  1. Matt777

    Matt777 Member

    Just bought Xenforo and imported my vbulletin forum into it. Xenforo is great. I just need to make one customization though that my vbulletin had.

    I have a custom usergroup called "Registered PRIVATE Users", whose posts should NOT be displayed to unregistered visitors.

    In vbulletin, my custom IF-conditional code looks like this, which is in the postbit template:
    Basically, to view a post you have to be either...
    a) a registered member
    b) a visitor, but it can't be a post by someone in the group Registered Private User

    My question is, how would I code this into Xenforo? It should be pretty simple I imagine.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> message

    Add the red code. You need to change the blue pieces appropriately (group_id and guest message). This is a direct translation of your condition:

    		<xen:hook name="message_content" params="{xen:array 'message={$message}'}">
    		<div class="messageContent">		
    				<blockquote class="messageText ugc baseHtml{xen:if $message.isIgnored, ' ignored'}">
    					<xen:include template="ad_message_body" />
    					<xen:if is="{$visitor.user_id} OR (!{xen:helper ismemberof, $message, 4} AND !{$visitor.user_id})">
    					{xen:raw $message.messageHtml}
    					<xen:else />
    			{xen:raw $messageContentAfterTemplate}
    Learner, CurveGotti and Matt777 like this.
  3. Matt777

    Matt777 Member

    Wow... thank you. Awesome. I'll plug it in and give it a go.
  4. Matt777

    Matt777 Member

    It works. Thanks.. (y)

Share This Page