View Full Version : Show Thread Enhancements - Show First Post Only To Unregistered User / Guest
Ported from: http://www.vbulletin.org/forum/showthread.php?t=181462
Thanks to ryans (http://www.vbulletin.org/forum/member.php?u=7059)
Fully tested on 3.8.1 - probably works the same on 3.8.2+
This is just a simple hack that will show the first post to unregistered users / guests. The rest of the posts in the thread will ask them to login or register. This is a template hack. Of course you can edit your own message.
Additions / Changes / Ideas are welcome.
In Postbit Templates edit the postbit_legacy or the postbit template depending on which one you use.
Find:
<!-- message -->
<div id="post_message_$post[postid]">
$post[message]
</div>
<!-- / message -->
Replace With:
<!-- message -->
<if condition="$show['member']">
<div id="post_message_$post[postid]">
$post[message]
</div>
<else />
<if condition="$post[postcount] == 1">
<div id="post_message_$post[postid]">
$post[message]</div>
</if>
<else />
<if condition="$show['guest']">
<if condition="$post[postcount] != 1">
<br><br>You Must be a registered member and logged in to view this response. To Register <a href=register.php>Please Click Here</a>
<br><br>
</if></if></if>
<!-- / message -->
Here is another version which puts a nice graphical box around the "Please Register Text"
Upload Warn.png to images/misc/
Add this CSS code to Additional CSS :
.warning-box,
{
color: #000;
border: 1px solid #000;
-moz-border-radius: 5px;
background-color: #defee3;
padding: 6px;
text-align:left;
}
.warning-box img,
{
float:left;
margin-top: 10px;
margin-right: 5px;
vertical-align:middle;
border: 0px;
}
.warning-box h2,
.warning-box p,
{
padding: 0px;
margin: 0px;
margin-left: 60px;
}
.warning-box h2,
{
padding-bottom: 4px;
font-size: 14px;
border-bottom: 1px solid #000;
}
.warning-box h1,
{
padding: 0px;
margin: 0px;
margin-left: 60px;
font-size: 12px;
font-weight:normal;
}
.warning-box h6,
{
margin: 20px;
padding: 0px;
margin-left: 60px;
font-size: 12px;
font-weight:normal;
}
.warning-box
{
background-color: #FFCCCC;
}
.warning-box ul,
{
margin-left: 30px;
}
In Postbit or Postbit_Legacy
find:
<!-- message -->
<div id="post_message_$post[postid]">
$post[message]
</div>
<!-- / message -->
replace with:
<!-- message -->
<if condition="$show['member']">
<div id="post_message_$post[postid]">
$post[message]
</div>
<else />
<if condition="$post[postcount] == 1">
<div id="post_message_$post[postid]">
$post[message]</div>
</if>
<else />
<if condition="$show['guest']">
<if condition="$post[postcount] != 1">
<div class='warning-box'>
<img src='images/misc/warn.png' alt='Warning' />
<h2><strong>Warning</strong></h2>
<h1><font color="#000000">
<br><br>You Must be a registered member and logged in to view this response. To Register <a href=register.php>Please Click Here</a>
</font></h1>
<br /><br /></div>
<br><br>
</if></if></if>
<!-- / message -->
Interesting Raptor, I like the custom CSS and the included image. One quick question though. How will this affect search engines indexing one's site??
I would think that most of the time the OP is what's important to a search engine.
Search engines crawl as guests so they wouldn't see the responses iirc
Black Tiger
02 May 2009, 02:04
Tagged this one for now.
Search engines crawl as guest but as a certain user agent:
http://www.pctools.com/guides/registry/detail/799/
People can imitate that, but maybe there is a way to change you mod and make a filter so the mod does not affect search engines.
I presume there are also user agent statements voor yahoo and others.
If it can be fixed that search engines still can crawl, I would be happy to use this mod.
Gersfan
09 Aug 2009, 16:49
I would be happy to use this mod. If you can a way that allows search engines to crawl,
sdavis2702
13 Aug 2009, 17:24
I agree. Search engine access and I REALLY like this one.
Gersfan
16 Aug 2009, 20:53
I don't really think, were going ot get what we want though are we? ha!
aJHier123
29 Aug 2009, 21:08
Here is another version which puts a nice graphical box around the "Please Register Text"
Upload Warn.png to images/misc/
Add this CSS code to Additional CSS :
.warning-box,
{
color: #000;
border: 1px solid #000;
-moz-border-radius: 5px;
background-color: #defee3;
padding: 6px;
text-align:left;
}
.warning-box img,
{
float:left;
margin-top: 10px;
margin-right: 5px;
vertical-align:middle;
border: 0px;
}
.warning-box h2,
.warning-box p,
{
padding: 0px;
margin: 0px;
margin-left: 60px;
}
.warning-box h2,
{
padding-bottom: 4px;
font-size: 14px;
border-bottom: 1px solid #000;
}
.warning-box h1,
{
padding: 0px;
margin: 0px;
margin-left: 60px;
font-size: 12px;
font-weight:normal;
}
.warning-box h6,
{
margin: 20px;
padding: 0px;
margin-left: 60px;
font-size: 12px;
font-weight:normal;
}
.warning-box
{
background-color: #FFCCCC;
}
.warning-box ul,
{
margin-left: 30px;
}
In Postbit or Postbit_Legacy
find:
<!-- message -->
<div id="post_message_$post[postid]">
$post[message]
</div>
<!-- / message -->
replace with:
<!-- message -->
<if condition="$show['member']">
<div id="post_message_$post[postid]">
$post[message]
</div>
<else />
<if condition="$post[postcount] == 1">
<div id="post_message_$post[postid]">
$post[message]</div>
</if>
<else />
<if condition="$show['guest']">
<if condition="$post[postcount] != 1">
<div class='warning-box'>
<img src='images/misc/warn.png' alt='Warning' />
<h2><strong>Warning</strong></h2>
<h1><font color="#000000">
<br><br>You Must be a registered member and logged in to view this response. To Register <a href=register.php>Please Click Here</a>
</font></h1>
<br /><br /></div>
<br><br>
</if></if></if>
<!-- / message -->
thanks ...
DamasGate
26 Nov 2009, 14:23
Is there anyway to show only the first post and total hide all other posts?
Thank you
ravenfaust
01 Dec 2009, 01:57
Agreed This will rune your forum if you rely on indexing.
Try this code for search enginee access with this mod :)
<!-- message -->
<if condition="$show['search_engine']">
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]</div>
</if>
<if condition="$show['member']">
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]</div>
<else />
<if condition="$post[postcount] == 1">
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]</div>
</if>
<else />
<if condition="$show['guest']">
<if condition="$post[postcount] != 1">
<div class='warning-box'>
<img src='images/misc/warn.png' alt='Warning' />
<h2><strong>Warning</strong></h2>
<h1><font color="#000000"><br /><br />Konunun devamindaki mesajlari okuyabilmek icin üye olmaniz gerekmektedir. <br />Lütfen Üye Olmak icin <a href=register.php>BURAYA</a> Tiklayin.
</font></h1>
<br /><br />
</div>
<br /><br />
</if></if></if>
<!-- / message -->
ecreweb
22 Aug 2010, 03:34
Thanks. :)
Black Tiger
25 Sep 2010, 01:13
Sorry but for the search engine adjustment... could you translate this to English for me?
Konunun devamindaki mesajlari okuyabilmek icin üye olmaniz gerekmektedir. <br />Lütfen Üye Olmak icin <a href=register.php>BURAYA</a> Tiklayin.
kpmedia
18 Feb 2011, 05:33
Sorry but for the search engine adjustment... could you translate this to English for me?
Google Translate says this is Turkish, and it means this:
You must be a member of the subject to read the subsequent posts . Please CLICK HERE to Become a Member
Black Tiger
18 Feb 2011, 14:38
Thank you.
Simon Lloyd
06 Apr 2011, 04:05
Try this code for search enginee access with this mod :)
<!-- message -->
<if condition="$show['search_engine']">
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]</div>
</if>
<if condition="$show['member']">
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]</div>
<else />
<if condition="$post[postcount] == 1">
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]</div>
</if>
<else />
<if condition="$show['guest']">
<if condition="$post[postcount] != 1">
<div class='warning-box'>
<img src='images/misc/warn.png' alt='Warning' />
<h2><strong>Warning</strong></h2>
<h1><font color="#000000"><br /><br />Konunun devamindaki mesajlari okuyabilmek icin üye olmaniz gerekmektedir. <br />Lütfen Üye Olmak icin <a href=register.php>BURAYA</a> Tiklayin.
</font></h1>
<br /><br />
</div>
<br /><br />
</if></if></if>
<!-- / message -->Hi Hassan, how would i work another condition in? you display only the first post to guests and display a message i would like to display only the first post to unconfirmed users but display a different message, like<if condition="is_member_of($bbuserinfo, 3)">PLEASE COMPLETE YOUR REGISTRATION</if>
could you help?
what about vb 4.1.3 - i would like to apply this mod on that version - i tryed but seams not possible :( - help?
oliver22
26 May 2011, 15:20
Yes, what about 4.1.x support ? Is there any other plugin to do this ?
Simon Lloyd
26 May 2011, 19:47
This mod is for vb3.8.x not 4.x however, i believe it should work if you change the if condtionals properly for vb4 i.e instead of <if you would use <vb:if
Traxdata
25 Jun 2011, 12:10
Just wondering if it is possible to show it in specific and not all subforums?
Simon Lloyd
25 Jun 2011, 13:26
Just add conditionals to exclude the forums you don't want it to work in :)
FockerFGAA
29 Jul 2011, 02:52
This mod is for vb3.8.x not 4.x however, i believe it should work if you change the if condtionals properly for vb4 i.e instead of <if you would use <vb:if
Can anyone test it on VB4?
I can't find the code to replace in postbit or postbit_legacy.
Traxdata
28 Nov 2011, 17:25
Just add conditionals to exclude the forums you don't want it to work in :)
unfortunately it won't work with
<if condition="$forum[forumid] != XXX"></if>
Simon Lloyd
28 Nov 2011, 18:26
unfortunately it won't work with
<if condition="$forum[forumid] != XXX"></if>Thats because in vb4.x you don't use <IF you use <vb:If ...etc
Traxdata
28 Nov 2011, 21:34
Im on vb3.7...
Simon Lloyd
29 Nov 2011, 06:46
try this:<if condition = "$thread['forumid']==x">where x would be your forumid
Traxdata
06 Dec 2011, 19:48
no way. have tried several codes but no one worked so far.
Simon Lloyd
06 Dec 2011, 20:58
and you're editing the right template and portion?
matrex722
28 May 2012, 23:41
is there any way to hide replys from sorce page
i mean when you view sorce page
i hope you understand me
GiorgioV
31 Jan 2016, 13:07
Hi,
is there something similar for 4.2.3 ?
Hi,
is there something similar for 4.2.3 ?
You could try:
Show First Post Only (http://www.vbulletin.org/forum/showthread.php?t=318588)
and exclude all usergroups except "Unregistered / Not Logged In". :)
GiorgioV
03 Feb 2016, 15:20
I tried it, but it doesn't work. I can see the message "All Posts Except The First and Yours Are Hidden From View" , but scrolling down i can see all the posts without login. I tried both setting "all" in the active forum option, and selecting specific forum. It doesn't work.. :(
I tried it, but it doesn't work. I can see the message "All Posts Except The First and Yours Are Hidden From View" , but scrolling down i can see all the posts without login. I tried both setting "all" in the active forum option, and selecting specific forum. It doesn't work.. :(
Are you using the "postbit" template, and not the "postbit_legacy" template? I meant to add support for the "postbit" template, but forgot...I will do that today. :)
GiorgioV
05 Feb 2016, 11:54
I tried with both templates, no way. All posts showed to unregistered users.
GiorgioV
07 Feb 2016, 13:42
Found and installed this (http://www.vbulletin.org/forum/showthread.php?t=248897&highlight=first+post+only) . It works fine . Anyway thank you very much.
vBulletin® v3.8.12, Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC.