Hide thread replies from guests

Anyone knows a way to do this in a simple way?
Here's one possible unfinished solution:

Edit the template: thread_view
Search:
HTML:
            <xen:include template="post" />

Replace with:
HTML:
            <xen:if is="{$firstPost.post_id} == {$post.post_id}">
                <xen:include template="post" />
            </xen:if>

You just need to complete the conditional with usergroups id and, if needed, with forums id.
 
Thanks for the suggestion :) I ended up doing this:

Code:
                <xen:if is="!{$post.isFirst} && !{$visitor.user_id}">
                <xen:else />
                <xen:include template="post" />
                </xen:if>

I will have to also hide page navigation, but it works great.
 
If you want more flexibility, you can read this:

The visitor object has an element called "permissions". Inside this element, we can find all the permissions groups.
So to access the permission group "Forum Permissions" (id: forum), here is the code:

>PHP:
PHP:
$visitor = XenForo_Visitor::getInstance();
$forumPerms = $visitor['permissions']['forum'];
>XenForo templates:
HTML:
{$visitor.permissions.forum}


We are going to add a new element to the permission group "Forum Permissions".
Go to: Administration => Development => Permission Definitions
Click on button "Create New Permission"
>Permission ID: sedo_canSeefirstPostOnly
(sedo is just a prefix, use yours)
> Title: Can only see first post of a thread
> Permission Group: Forum Permissions
> Permission Type: Flag
> Interface Group: Forum Permissions
> Display Order: 999
(as you want)
> Addon: if you want to integrate this permission inside an addon

To access this new permission:
>PHP:
PHP:
$visitor = XenForo_Visitor::getInstance();
$forumPerms = $visitor['permissions']['forum']['sedo_canSeefirstPostOnly'];
>XenForo templates:
HTML:
{$visitor.permissions.forum.sedo_canSeefirstPostOnly}

Now to configure which usergroup should be applied this "permission" (which is here more a restriction than a permission)
Go to: Administration => Users => Group Permissions
Select your Usergroup and configure the new "permission"


So now edit the template thread_view (you can use TMS if you want)

Search:
HTML:
                <xen:include template="post" />

Replace with:
HTML:
                <xen:if is="{$visitor.permissions.forum.sedo_canSeefirstPostOnly}">
                    <xen:if is="{$firstPost.post_id} == {$post.post_id}">
                        <xen:include template="post" />
                        <xen:comment>You can add a custom message here with a phrase or a new template (use the same command than above</xen:comment>
                    </xen:if>
                <xen:else />
                    <xen:include template="post" />
                </xen:if>

Now if you want to configure this permissions by forums, I can't really help you (except with using another conditional) because that's something I still don't understand with the XenForo Permissions system. I mean, in theory if you set the permission "canSeefirstPostOnly" on a usergroup, you should select a node and revoke this permission to allow users to see others posts... but it doesn't work, at least on my boards.

If someone has an explanation on this, I will more than happy to hear it.
 
I thought bout something like this but it always drove me nuts on forums. There is a couple that worked at getting me to join. I was on one in the last month that showed the first 5 posts. I like this because it allows you to see the type of answers people are getting on the forum and or get a small feel for the forum. And it kinda gives you just enough to get interested in a thread and then cuts you off. Might work at getting some to join.

Is that possible?

James
 
Top Bottom