How To Exclude Postbit Items From Showing In PM's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peterska2
    Senior Member
    • Oct 2003
    • 8869
    • 3.7.x

    How To Exclude Postbit Items From Showing In PM's

    You know the situation, you have a modified board with lots of information in the postbit template, but you don't need any of it to be showing in PM's. But what can you do to stop it? This guide will show you how to prevent anything at all in the postbit template from appearing in PM's.

    IMO, the only thing that needs to be in the postbit for a PM is the username. Of course, everyone has different opinions on this, so I'm going to show you how to exclude different parts of the postbit from appearing in PM's.

    All the code snippets are taken from the postbit template, but will give you an idea on what to do with the postbit_legacy template.


    Part One: Excluding the Avatar

    The avatar section of the postbit template looks like this:
    Code:
    <if condition="$show['avatar']"><td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if>
    To hide the avatar in PM's we need to tell it to only display if this page is not part of the PM system.

    To do this we need to make one change to the code. Changing the line
    Code:
    <if condition="$show['avatar']">
    to
    Code:
    <if condition="$show[avatar] && THIS_SCRIPT!='private'">
    stops the avatar code from being processed in the PM pages.

    The important part of this code is the
    Code:
    && THIS_SCRIPT!='private'
    This tells us that in addition to the previous condition it is also checking that the page is not private.php

    The same format is used for every place that a current condition is used to display text.


    Part Two: Excluding the Post Count, Join Date, and other information

    In the default postbit template, there is a section of code that looks like this:
    Code:
    <div class="smallfont">
                        <if condition="$post['joindate']"><div>$vbphrase[join_date]: $post[joindate]</div></if>
                        <if condition="$post['field2']"><div>$vbphrase[location_perm]: $post[field2]</div></if>
                        <if condition="$post['age']"><div>$vbphrase[age]: $post[age]</div></if>
                        <div>
                            $vbphrase[posts]: $post[posts]
                        </div>
                        <if condition="$show['infraction']"><div>$vbphrase[infractions]: $post[warnings]/$post[infractions] ($post[ipoints])</div></if>
                        <if condition="$show['reputation']"><if condition="$show['reppower']">$vbphrase[reppower]: <span id="reppower_$post[postid]_$post[userid]">$post[reppower]</span> </if><div><span id="repdisplay_$post[postid]_$post[userid]">$post[reputationdisplay]</span></div></if>
                        <div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon] $post[skypeicon]</div>
                    </div>
    You can exclude this by simply placing
    Code:
    <if condition="THIS_SCRIPT!='private'">
    before it and
    Code:
    </if>
    after it.

    This code works for anywhere in the postbit where there is not already an if statement.


    Part Three: Including Information Only In PM's

    To include information only in PM's then you need to make a change to the condition used. Instead of using
    Code:
    THIS_SCRIPT!='private'
    which is telling us that it is NOT the private message, you need to tell it that it is the private message by using
    Code:
    THIS_SCRIPT=='private'
    The Important Bit And Using This Technique With Other Files

    The main difference between including and excluding is this:

    != means is not
    == means is

    You can use this to show items on any page on your site depending on the template that you are editing. The part that comes after the != or == is the name of the page as defined in the php file. You can find this by opening the php file for the page that you are interested in and looking for the line that says
    Code:
    define('THIS_SCRIPT', 'member');
    This is taken from member.php which is the page for the profiles, but it is the same format on every page used in vBulletin, including most modification files.


    Conclusion

    You have now learnt how to remove sections of the postbit template from PM's. Simply by following both steps above, you have left yourself with just the user name, user title, and user rank of the person how has sent the PM. Using the method in step one, you can also remove the user rank and user title. The same method can be used to remove the username, but why you would want to do that I don't know (it could be an interesting April Fools Trick though ).


    I hope that you have found this useful.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...