Jump to content

Hide all but first posts from guests?


AlexWebsites

Recommended Posts

7 hours ago, sweethoney said:

got to one of your forums and just edit the permission guest so they can see the forum if that's what you mean..so if you want the guest to only see a forum that you want and the others they can intill they sing up

The requirement is that he allows guests to view the forum, and its topics.....but within the topic the guest can only read the first post. All other posts cannot be read by the guest....so they have to login. Like so:

Screenshot_2.png

It can't be done with the IPS software 'out of the box' and would need a plugin, or a theme edit, to achieve this (just like with IPB 3.4.x, which is where the above screenshot is taken...uses a hook called HidePost) and none of your suggestions will make it work like that.

Link to comment
Share on other sites

Edit your theme, specifically forums -> front -> topics -> post

Locate:

			{$comment->content()|raw}
			{{if $comment->editLine()}}
				{$comment->editLine()|raw}
			{{endif}}

Enclose it with an if/else/endif that checks for group membership and to see if the post is NOT the first in the topic:

{{if \IPS\Member::loggedIn()->member_id === NULL and !$comment->mapped('first')}}
	NOPE!!!! You're a guest so you're not reading this!!!
{{else}}
			{$comment->content()|raw}
			{{if $comment->editLine()}}
				{$comment->editLine()|raw}
			{{endif}}
{{endif}}

and save.

Screenshot_3.png

Link to comment
Share on other sites

3 hours ago, Nathan Explosion said:

Cool - will send over an xml file for you to try, once I'm done with my testing. It's pretty basic, just following the dev docs guide on creating one...but at least you'll be able to modify the message without having to edit the theme each time (and obviously, won't need to put the theme edit in there in the first place)

Sounds great!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...