Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > Programming Articles
How To Exclude Postbit Items From Showing In PM's
peterska2
Join Date: Oct 2003
Posts: 6,504

 

Manchester, UK
Show Printable Version Email this Page Subscription
peterska2 peterska2 is offline 06-18-2006, 10:00 PM

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. If you have any questions about it, feel free to ask.
Reply With Quote
  #2  
Old 06-20-2006, 10:48 PM
G_Man G_Man is offline
 
Join Date: Feb 2006
Location: Washington State
Posts: 264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great timing!!

I have a hack that isn't needed in PM's and was brought to my attention yesterday that it isn't working right either, so...

Used your trick and voila!!


Thanks for posting that.
Reply With Quote
  #3  
Old 12-31-2006, 01:01 AM
HPIA HPIA is offline
 
Join Date: Jul 2006
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are a genious. Where would my newb self be without you :love:
Reply With Quote
  #4  
Old 12-22-2007, 10:49 PM
Soliloquy's Avatar
Soliloquy Soliloquy is offline
 
Join Date: Mar 2006
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've used this tutorial to take out the user information on the right and replace it with a "postage stamp". Here's the Christmas version:
Reply With Quote
  #5  
Old 12-22-2007, 11:09 PM
valdet's Avatar
valdet valdet is offline
 
Join Date: Feb 2007
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is another great resource. Thank you very much.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:08 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.13665 seconds
  • Memory Usage 2,254KB
  • Queries Executed 21 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (10)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete