vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   How To Exclude Postbit Items From Showing In PM's (https://vborg.vbsupport.ru/showthread.php?t=118989)

peterska2 06-18-2006 10:00 PM

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 :p).


I hope that you have found this useful. If you have any questions about it, feel free to ask.

G_Man 06-20-2006 10:48 PM

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. :D

HPIA 12-31-2006 01:01 AM

You are a genious. Where would my newb self be without you :love:

Soliloquy 12-22-2007 10:49 PM

1 Attachment(s)
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:

valdet 12-22-2007 11:09 PM

This is another great resource. Thank you very much.


All times are GMT. The time now is 05:01 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01066 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete