PDA

View Full Version : Advanced Templates: Dynamic Templates Changing according to different conditions


Pages : [1] 2

Logician
09-07-2002, 10:00 PM
This hack allows you to design dynamic vb templates which change themselves according to different conditions. Thus you can customize your board very powerfully with "intelligent/interactive" templates. It uses the same "conditional concept" just like my Webtemplates (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419) and Dynamic Forum Announcements Hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=43194). With conditionals you can program your templates to: be displayed differently to different users.
hide/display some part/texts/html codes/even the entire template for some users
include extra text/HTML codes/secret messages inside which will be displayed if page visitor matches your pre-configured criterias
Have multi-templates inside 1 template and each of them will be parsed and displayed only if their set condition applies.You can program your templates according to many different criteria, such as: user's userid
user's usergroup
user's profile fields' input
user's post number
user's last visit time
user's seniority (register date)
today's date, day, month, week, year, hour, second, if today is user's birthday
user's is visibility status
style id user's using
user's cookie status
user's time settings
(in forumdisplay templates) forum id
(in showthread templates) thread id
etc.
Some practical examples about what you can do with this hack: You can have different postbit templates for different users/usergroups.
Display your board differently to the user if it's his birthday, if he is X, if he age <Y, if he didnt visit your board since Z etc.
Display Admin Only Profile fields/or any profile fields in postbit if X condition applies
You can hide Admin only links in your templates such as "Show IP".
Disable Email/Pm User links in postbit or userprofile screen if reader is from usergroup X etc.
Send different email text to different users according to different criteria. Add hidden email texts if X condition applies
Hide "register" link if user is not a guest, add access to pm if user is not a guest
Ban some templates if X condition applies such as dont display profile screens if user's X profile field = Y
Disable some forums if today is X day or hour is Y
Dont display thread view/user count/last reply date if user's usergroup is X
Hide threads according to different criteria in showthread templates
Well there are literally millions of possibilities you can apply, so please use your imagination for more examples.. :)

The Hack's Features: Installation is VERY easy: Actually 2 steps in 1 file will take less than 1 minute..You will be surprised how such a small modification will make such a big difference in your board.
It's compatible with ALL vb versions I know
The hack covers all the templates in your database: ie. custom templates, ALL vbulletin templates including even emails and error messages etc.
It's fully compatible with all your installed hacks and their custom templates too.
It makes many small hacks obsolete because you can now modify your templates to achieve the same result instead of hacking your board (=changing .php files)

Vbulletin v.3 has been announced to have "conditional" concept in templates, however my hack wasn't inspired by it at all, because I'm using the conditionals in my Webtemplates (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419) hack since March 2002 so in fact vb developers might be inspired by me. ;) My Dynamic Forum Announcements hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=43194) uses the same concept for forum home announcements too.. (Wait for my other hacks depending on conditionals cause I really like them, they are really powerful and customizable)

Performance Issues
The hack does NOT add any MYSQL connections. It just process your already retrieved templates in a function to parse the hack conditionals. Thus the performance is IMO quite bearable. However please notice that if a template has a conditional in it, the hack have to parse it before displaying it and technically this parsing is done with PHP's preg_match command which is known as a powerful but slow command. So does it cause any performance problems? In most cases no. But if the conditionals are applied in a very frequently used and/or long template and/or you used too many conditionals in one template AND your traffic or server load is high, this MAY increase your PHP processing time whenever this template is displayed as the hack has to deal with the conditionals everytime this template is called. I suggest applying Teck's Microstat's hack and observe the PHP running time with that hack after you applied a conditional especially in a frequently used template (eg. postbit). If it slows down the display, simply reduce your conditional count in that template or delete the conditional or remove the hack altogether. Personally I dont have any performance problems in my own board related to this hack but just wanted to give my 2 cents anyway especially for high-traffic boards..

If you liked the hack (I guess you will), I strongly suggest checking out my Webtemplates hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419) which provides exactly the same feature for your NON-VB pages.

Also please click INSTALL (https://vborg.vbsupport.ru/misc.php?s=&action=install&threadid=43325) if you use the hack, thank you..

09.Sep.2002 Bug Fix: If you installed the hack before 09.Sep.2002 please download the instructions again and reapply step 2, since I made an update for a small bug fix. There was a variable name collision which causes a problem with email validation screen which uses the same variable so I changed my variable's name. If you are downloading the hack now, go ahead.. The code you download is already fixed..
07.Oct.2002 UPDATE: I updated the hack code, so that people who have enabled template debugging in their Admin CP/vb Settings can also use the hack. Also small modification applied to increase template parsing time. If you installed the hack before my update, you may choose to reinstall (not necessary). If you are a new hack user, the instructions you download is already new version's.

Enjoy!
Logician \\=^))

Logician
09-08-2002, 05:19 PM
Screenshot?

umm what kind of screenshot I can provide you is not clear to me :) Still reserved in case someone has an idea though.. lol

Logician
09-08-2002, 05:20 PM
Conditionals Help

If you are using my WebTemplates Hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419) or Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals Hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=43194), this hack's conditionals are exactly same with these hacks'.

Here is the conditional syntax: (it's strict in syntax so please apply correctly!)
[[(your conditional)]]
HTML code posted in template if condition applies
[[/(your conditional)]]

Conditional Rules:

* Conditionals are covered inside [[ ]] tags
* Conditional (both opening and closing) itself is in paranthesis ( )
* HTML codes are written in between the conditional tags and they are displayed in the template if condition applies
* Opening and closing conditional are exactly same except closing conditional has a / right before (
* If you are trying to check if X equals to Y, use DOUBLE equation mark not single. eg. Correct: X==Y Incorrect:X=Y
* You can design as many conditional as you like. If more than 1 condition applies at the same time, ALL applying conditionals HTML codes are parsed and all not-applied conditionals and their HTML code is automatically deleted when template is displayed.

Some examples will help you understand the rules better. Here are some conditionals and their instruction texts which explains what that conditional do: (Consider HTML codes is in between instead of instruction texts and they are parsed if condition applies)

* [[($bbuserinfo[userid]==32)]] Display this HTML code if page visitor's user id is 32 [[/($bbuserinfo[userid]==32)]]

* [[($bbuserinfo[usergroupid]==5)]] Display this HTML code if page visitor's usergroupid is 5 (=if he is a Super Mod) [[/($bbuserinfo[usergroupid]==5)]]

* [[($bbuserinfo[usergroupid]==1)]] Display this HTML code if page visitor is a guest [[/($bbuserinfo[usergroupid]==1)]]

* [[($bbuserinfo[userid]>1)]] Display this HTML code if page visitor is NOT a guest [[/($bbuserinfo[userid]>1)]]

* [[($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]] Display this HTML code if page visitor's a Super Mod OR a Mod OR an Admin [[/($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

* [[($bbuserinfo[posts]<10)]] Display this HTML code if page visitor has less than 10 posts [[/($bbuserinfo[posts]<10)]]

* [[($bbuserinfo[lastvisit] and $bbuserinfo[lastvisit]<strtotime("-30 days"))]]Display this HTML code if page visitor has not visited your board for 30 days[[/($bbuserinfo[lastvisit] and $bbuserinfo[lastvisit]<strtotime("-30 days"))]]

* [[($bbuserinfo[joindate]>strtotime("-2 weeks") AND $bbuserinfo[joindate]<strtotime("-4 weeks"))]]Display this HTML code if page visitor registered in a date between 2 weeks to 4 weeks from now[[/($bbuserinfo[joindate]>strtotime("-2 weeks") AND $bbuserinfo[joindate]<strtotime("-4 weeks"))]]

You can use conditionals together too. Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[[($bbuserinfo[userid]==32)]] HTML Codes 1[[/($bbuserinfo[userid]==32)]]
[[($bbuserinfo[usergroupid]==3)]] HTML Codes 2 [[/($bbuserinfo[usergroupid]==3)]]
HTML Codes 3
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
When this template is called the hack will :
Display HTML Codes 1, if user's userid = 32
Display HTML Codes 2, if user's usergroupid = 3 (=email confirmation waiting members)
and always display HTML Codes 3 (it's out of conditionals)

What if user 32 is also from user groupid 3? He will be BOTH displayed HTML Code 1 AND 2 because both conditionals are parsed if they applies.

Another example of how you can design a multi-template:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[[($bbuserinfo[posts]<30)]]

<Your Templates default HTML Code here >

[[/($bbuserinfo[posts]<30)]]
[[(!($bbuserinfo[posts]<30))]]

You dont have permission to access this page!

[[/(!($bbuserinfo[posts]<30))]]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
When you use this code in any of your template, if page visitor's post number is less than 30, he will be displayed "You dont have permission to access this page!" but any other users will see the template.

My Support for this hack: Just like all my other hacks I support this hack for any installation problems, bugs etc. (very unlikely there will be any) but as you would hopefully understand it's impossible for me to support the hack about forming your "conditionals". I give you detailed how-to instructions and samples and but there can be thousands of conditional designs people might ask for and it's not possible for me to answer all the time one by one. I dont discourage you to ask them away here in this thread so be my guest if you need help, but please forgive me if I cant personally answer you about these requests and I hope that other hack users will help out in the thread for these requests.. (While asking it can help if you give your failed samples).. Thanks for understanding..

Logician
09-08-2002, 05:20 PM
After you installed the hack, you can apply some of these template modifications which you may enjoy. Please share your useful template modifications with other hack users in the thread and if you get the concept please help me out answering questions regarding conditionals here. Thank you!

BTW. Some examples may seem irrelevant to you but please notice that my intention is also to give you conditional samples so that you get the grips.

Hide attachments in the thread from viewer if his registration date is newer than 2 weeks:
edit template postbit_attachment and just in the begining add: [[($bbuserinfo[joindate]>strtotime(-2 weeks)]] and at the end add its closing tag: [[/($bbuserinfo[joindate]>strtotime(-2 weeks)]]

Displays poster profile field 1 in postbit to Admins: (So you can access Admin only fields of user in postbit)
Edit postbit template add

[[(bbuserinfo[usergroupid]==6)]]<smallfont>Admin Only info: $post[field1]</smallfont>[[/(bbuserinfo[usergroupid]==6)]]



Hides User's Username in postbit if viewer is a guest
Edit postbit template replace $post[username] as

[[(bbuserinfo[usergroupid]>1)]]$post[username][[/(bbuserinfo[usergroupid]>1)]]


Hide thread X in showthread if user id is Y add [[($threadid!=X AND userid!=Y)]] in the begining of showthread template add its closing tag in the end: [[/($threadid!=X AND userid!=Y)]]

Send entire message text with notification mail if forumid is Y
edit email_notify add: [[($foruminfo[forumid]==Y)]]$message[[/($foruminfo[forumid]==Y)]]

Chris M
09-08-2002, 05:22 PM
Very cool:)

*installs*

Satan

assassingod
09-08-2002, 05:28 PM
Aww man, this is Ace! Brilliant work! Gonna instal this!!:)

Tim Wheatley
09-08-2002, 05:52 PM
Fantastic, absolutely bloody fantastic. :)

Bison
09-08-2002, 06:18 PM
I just installed this hack and now my index.php page won't load! :mad:

Chris M
09-08-2002, 06:41 PM
Did you make sure you did the modifications to :

admin/functions.php

Satan

Logician
09-08-2002, 07:39 PM
Originally posted by Rolodex
I just installed this hack and now my index.php page won't load! :mad:
1- Make sure you applied the hack correctly.
2- Make sure you understand how to apply a conditional to your templates before taking actions. If you inserted a wrong conditional simply delete it from your template and you'll be just fine again. I strongly suggest you to work on how-to post and understand the conditional syntax before playing with your templates.

Hack code is tested and working ok. But this is a powerful so a little bit tricky hack especially in usage (in fact this makes it powerful) so please take your time first to understand the basic concepts so that you wouldnt have any problems..

Dean C
09-08-2002, 07:51 PM
this is just too good to be true :D

awesome hack mate

- Mist

Neo
09-09-2002, 01:57 AM
In one sentence what does this do?

Austin Dea
09-09-2002, 02:25 AM
Look at the thread title if you really want it in one sentence -_-...

I have to say I am AMAZED by your hacks Logician. They have so much functionality and are so much more advanced than most other hacks. Great job, keep up the good work ;).

SemperFidelis
09-09-2002, 05:17 AM
Another brilliant hack by Logician
Well done and thankyou
:D

Logician
09-09-2002, 05:54 AM
Originally posted by Neo
In one sentence what does this do?
You can program your vb templates to display different HTML codes to your visitors under different conditions. So they are not static anymore..

Since you are a hacker this information can clarify things better for you:
After you installed the hack you dont need to hack vb. code for this:

if ( any condition goes here)
{
eval("dooutput(\"".gettemplate("ANY TEMPLATE GOES HERE")."\");");
}
else
{
eval("dooutput(\"".gettemplate("ANY TEMPLATE GOES HERE")."\");");
}


You can now do the same thing by editing the relevant template and insert:

[[(your condition goes here)]]
HTML codes displayed if your condition applies
[[/(your condition goes here)]]
Other HTML codes displayed regardless of your condition


Hope this helps a bit..

Marshalus
09-09-2002, 08:23 PM
Simply amazing. A definate nomination for vB hack of the month, hell, hack of the year. This will revolutionize the way people hack their boards, I know I have a lot of uses for this hack just by reading through the description.

/me installs.

NuclioN
09-09-2002, 11:10 PM
Absolutly a genious mod! Clicks install in a string :D
I guess this opens the way for creative codehackers to create new, funny and smart hacks for the VB forum.

fastforward
09-09-2002, 11:50 PM
Originally posted by Logician
Vbulletin v.3 has been announced to have "conditional" concept in templates, however my hack wasn't inspired by it at all, because I'm using the conditionals in my Webtemplates (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419) hack since March 2002 so in fact vb developers might be inspired by me. ;)
Great hack Logician, but Ed was inspired way before March 2002 :) :
https://vborg.vbsupport.ru/showthread.php?s=&threadid=16743&highlight=conditionals

Like I said though, great hack and thanks... I'll be using it.

Logician
09-10-2002, 07:05 AM
Originally posted by fastforward

Great hack Logician, but Ed was inspired way before March 2002 :) :
https://vborg.vbsupport.ru/showthread.php?s=&threadid=16743&highlight=conditionals

Like I said though, great hack and thanks... I'll be using it.
thx for pointing this out, I didnt know that thread (in fact I didnt even have vb then)..

So they might not be inspired by me, but at least I'm not inspired by them either.. :knockedout:

Abbas
09-10-2002, 07:27 AM
Great hack!

Using conditionals will it be possible to have separate templates for categories of forums? Or will you have to have a conditional for each forum in that category. I'm basically going to aim to have separate sections of my forum with different graphical styles etc.

Thanks
-Abbas

Logician
09-10-2002, 08:19 AM
Originally posted by Abbas
Using conditionals will it be possible to have separate templates for categories of forums? Or will you have to have a conditional for each forum in that category. I'm basically going to aim to have separate sections of my forum with different graphical styles etc.

I cant say anything before knowing what exactly you have in your mind but in the first look yes it seems you can do it via conditionals. The hack does not allow you to create multiple templates for one, but by using a conditional trick you can create multi-templates inside one template:

Example:

[[(($bbuserinfo[userid]==1))]]
Your HTML codes if user's userid is 1
[[/(($bbuserinfo[userid]==1))]]
[[(!($bbuserinfo[userid]==1))]]
Your HTML codes if user's userid is NOT 1
[[/(!($bbuserinfo[userid]==1))]]

So as you see we have one template but within it we actually have two, each of which will be displayed according to user's userid. (Notice ! sign which is used like "else")

However I might say that if you are trying to apply different styles for different forums you dont need a hack, you can do it by configuring your forum styles.. I believe you already know that?

Abbas
09-10-2002, 08:29 AM
Thanks for that info. Yeah I know different styles can be done without hacks, but there may be different templates involved not just graphical styles alone, e.g. our gaming forums may have other templates for clan and multiplayer stuff etc...

-Abbas

AndrewD
09-10-2002, 06:41 PM
Does this work ok with 2.2.6? I installed it as per instruction but conditional tests simply get reflected back unchanged.

I tried the advanced_functions code as a stand alone and it seems fine. Perhaps I've made a silly mistake somewhere ;)

Logician
09-10-2002, 08:07 PM
Originally posted by AndrewD
Does this work ok with 2.2.6? I installed it as per instruction but conditional tests simply get reflected back unchanged.

I tried the advanced_functions code as a stand alone and it seems fine. Perhaps I've made a silly mistake somewhere ;)
yes it works with all vb versions I know.. Have you uploaded the file to your server? :)

More likely your condition didnt apply so it wasnt parsed. What condition did you test and where?

Martin CX
09-10-2002, 08:10 PM
Wow! I can't wait to try this out!

/me clicks install button

AndrewD
09-11-2002, 05:58 AM
Sorted out my problem re conditionals not getting parsed.

gettemplate actually contains two return statements - the first executed only if you have enabled template debugging. I had this option enabled, so the call to advanced_templates was not being made.

you need to make the following change to gettemplate

if ($gethtmlcomments and $addtemplatename) {
return advanced_templates(
"<!-- BEGIN TEMPLATE: $templatename -->\n$template\n<!-- END TEMPLATE: $templatename -->"
); }
return advanced_templates($template);

Great job, thanks

memobug
09-12-2002, 11:28 PM
This looks great! I have two questions with how it might work:

1) Is the html between the conditionals parsed, that is if I use a variable name in the html there will it be replaced with its value or will it stay as-is?

2) Can I put a "virtual include" in there in the html conditional? I've done this before using php-include template, but I'm wondering if I can get around that.

Many thanks,

Matt

Logician
09-13-2002, 08:11 AM
Hi Matt,
Originally posted by memobug
1) Is the html between the conditionals parsed, that is if I use a variable name in the html there will it be replaced with its value or will it stay as-is?

2) Can I put a "virtual include" in there in the html conditional? I've done this before using php-include template, but I'm wondering if I can get around that.

The parsing of templates does not change after you installed the hack. So you can answer all your questions according to this fact: Your advanced template would exactly do the same parsing if it was a normal vb template. :)

The hack only checks the template if there is special conditional tags inside and acts like this:
a) if the template does not include any conditional, it takes no action and returns the entire template just like a normal vb. template.
b) If the template has conditionals, the hack checks them one by one and
ba) if condition is FALSE, it deletes this condition (and its HTML code in between) from the template, as if it never existed in the template
bb) If condition is TRUE, it deletes only the condition tags and keeps the condition's HTML code in between so that it will be parsed.

As you see it does not interfere with vb's default template processing in anyway..

Hope this helps..

Koss
09-16-2002, 08:27 AM
hi

will this edit all my style templates if I just edit the template of one style?

thanks

Logician
09-16-2002, 11:09 AM
Originally posted by Koss

will this edit all my style templates if I just edit the template of one style?

I am not sure if I got the question correctly? After you installed the hack nothing changes in your board unless you apply a conditional to any template in any style set. After the installation, your templates will behave just exactly how they behave before and you'll NOT notice any difference in their display or something. However from now on you will be able to apply a conditional to any template in your database. Ie. your default templates in any style sheet, your custom templates, the templates the hacks you installed created, just anything. Whenever you add a conditional to any template, this template will be displayed according to this conditional. This is how this hacks works and I hope it answers your question too..

AndrewD
09-17-2002, 05:35 PM
Sorry to tell you this...

There is an obscure bug when this hack is installed, a user forgets his password and he requests a new one. One ends up with a PHP parse error.

The bug is as follows:

VBulletin uses $a as a global variable in the reset password code (around line 174 of member.php). This messes up use of $a as the command argument in advanced_templates.

Solution: use a variable in advanced_templates which does not have global scope. (e.g. replace $a by $basictemplate)

Logician
09-17-2002, 06:13 PM
Originally posted by AndrewD
There is an obscure bug when this hack is installed, a user forgets his password and he requests a new one. One ends up with a PHP parse error.

Andrew, I have already noticed that bug, released an update and sent it to hack users via email (for ones who clicked "install" in the hack thread) in September 9th. I put the bug notice and fix into thread's first message and the hack instruction has also been corrected..

Since you wisely noticed the bug and its cause, I'm sure you already fixed it in your board but if you didnt, you can get the updated file and correct the problem.. :)

Thx for the feedback though..

AndrewD
09-17-2002, 06:18 PM
You're too quick for me, Logician - or rather I'm too slow and bleary eyed by this time of day

Have now clicked on install, so that you can duly tell me the next wonderful things you achieve

trainer
09-21-2002, 03:30 PM
i am seeing

[[(6==6)]]

Advanced Templates Hack has been successfully installed! By the way this remark is visible to Site Admins only.. ;) Enjoy..
Logician \\=^))

[[/(6==6)]]


in the index.php page. how do i get rid of the [[(6==6)]] and [[/(6==6)]]

so i will only see the message?

just checked and seeing

[[(2==6)]]

Advanced Templates Hack has been successfully installed! By the way this remark is visible to Site Admins only.. ;) Enjoy..
Logician \\=^))

[[/(2==6)]]


in the index.php page. how do i get rid of the [[(6==6)]] and [[/(6==6)]]


anyone else having this problem?

Freddie Bingham
09-21-2002, 03:43 PM
Originally posted by fastforward

Great hack Logician, but Ed was inspired way before March 2002 :) :
https://vborg.vbsupport.ru/showthread.php?s=&threadid=16743&highlight=conditionals

Like I said though, great hack and thanks... I'll be using it. Yes conditionals were one of the first things to go into vb3 and that was before March 2002.

As for technical details:

1. You can do if/else constructs
2. The conditionals are parsed at the time you edit your templates since we now store two copies of every template. One with the conditionals asis, and one with any conditionals converted to accompanying php code so that there is no overhead when the templates are called by the forum.

Logician
09-21-2002, 08:49 PM
Originally posted by trainer
how do i get rid of the [[(6==6)]] and [[/(6==6)]] so i will only see the message?

Trainer please login to your Admin CP, choose vb settings and disable "Add template name in comments".. This should fix your problem.. If this fixes the problem and you are determined to keep this option enabled, AndrewD posted the code to apply in this thread a few post above, please apply this one.. But IMO there is no need have this settings on all the time..

Logician
09-21-2002, 09:02 PM
Originally posted by freddie
Yes conditionals were one of the first things to go into vb3 and that was before March 2002.

Great.. Although this is usually for power users, I believe conditionals add a lot of functionality to the board, so it's a very valuable addition to the script.. I'm using the concept since my webtemplates hack and didnt know you intented to add it to vb 3 and I'm very glad you did..

2. The conditionals are parsed at the time you edit your templates since we now store two copies of every template. One with the conditionals asis, and one with any conditionals converted to accompanying php code so that there is no overhead when the templates are called by the forum.
I dont exactly understand what kind of algorithm you are following but if I'm not wrong, it will be much different than my approach. I parse them on the fly and I accept that this can add a small (IMO bearable) overhead to running time, but I believe it's the only way to code it, if functionality is the primary concern. This helps to have more than 1 conditionals in every template and also allow any variable to be used as a conditional.

Of course I'm sure you have a nice algorithm either.. :)

Xenon
09-22-2002, 10:16 AM
perhaps you've read that already, but if not:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=55163&pagenumber=2

Logician
09-22-2002, 03:01 PM
Originally posted by Xenon
perhaps you've read that already, but if not:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=55163&pagenumber=2
thx for the link Pal, but that explanation is still unclear to me.. The only educated guess I can make from that statement is that vb3 will save the conditionals seperate from the template itself so that they could be eval'ed without need to parse through the template but it's still not clear to me how this would increase the template parsing time.. If a condition is met, there will be still a replacement (= parsing) in template. The only gain would be while searching through the template if it has a conditional or not but well considering the templates sizes are not so big, IMO its overhead increase should be very trivial..

It's just a "substr_count" that's saved (which I intend to add to my hack too) but IMO it does not effect running time so significiantly..

Or I still didnt get how it will work? lol

trainer
09-22-2002, 10:51 PM
what is this like on server load? it seems to be pretty hard on my site. any ideas?

Logician
09-23-2002, 08:27 AM
Originally posted by trainer
what is this like on server load? it seems to be pretty hard on my site. any ideas?
IMO it's performance is quite good. For once there is no extra SQL connection this hacks creates on your site so it doesnt increase MySQL load. As for PHP performance, it's quite bearable and the increase is very trivial (at least in my site). Check my message a few lines above for its reason. But if you want to make sure, install Nakkid's (Teck) microstats hack and check the PHP running time before and after the hack. There is no significant load in my site..

But if you want to improve the performance better, here is a code I was already planning to add to the hack:

edit functions.php, find:
return advanced_templates($template);
Replace it AS:

if (substr_count($template,'[[/(')>=1)
{
return advanced_templates($template);
}
else
{
return $template;
}


This will stop parsing for regular templates (=not having conditionals inside) thus will increase the performance..

BTW. Did my suggestion work for your problem?

trainer
09-23-2002, 01:23 PM
once again thanks for the reply Logician. your sugestion worked for my first problem. didn't even know what that was until you pointed it out!

Marshalus
10-02-2002, 04:19 PM
Does anyone know if this adds any additional DB queries?

Logician
10-02-2002, 04:37 PM
Originally posted by Marshalus
Does anyone know if this adds any additional DB queries?
No it does not..

Please check 2 posts above..

BlueVoltage
10-04-2002, 04:42 PM
I tried installing this twice! I keep getting this error:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/xelerix/public_html/x/admin/functions.php on line 823

Fatal error: Call to undefined function: vbdate() in /home/xelerix/public_html/x/admin/sessions.php on line 407

BlueVoltage
10-04-2002, 04:42 PM
I tried installing this twice! I keep getting this error:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/xelerix/public_html/x/admin/functions.php on line 823

Fatal error: Call to undefined function: vbdate() in /home/xelerix/public_html/x/admin/sessions.php on line 407

Logician
10-04-2002, 05:36 PM
Originally posted by BlueVoltage
I tried installing this twice! I keep getting this error:

If you are sure you applied step 2 correctly (it is REPLACE AS, not insert BEFORE or AFTER, and make sure you changed the file in Notepad), post here your functions.php just lines between 810 - 850, not the whole file) and let me see what you did wrong..

BlueVoltage
10-04-2002, 10:17 PM
i got it now. sorry. GREAT HACK!!!

mikey8270
10-04-2002, 11:07 PM
great hack :)

is there any way to make it show like 'You have relied to this thread' or You have not replied to this thread' somewhere on the showthread page to everybody except guests?

g-force2k2
10-05-2002, 02:32 AM
meh... okay Logician buddy im looking to you for support now :p

anways i get the infamous 6==6 as stated in the past posts...

only problem is i don't use debug mode for the templates (i checked) and i even made the appropriate change just incase and it didn't seem to solve my problem ;P either way excellent hack...

its probably just something 'stupid' ;) anyways could it have anything to do with php version? thanks in advance man... superb work as always :)

g-force2k2

Logician
10-05-2002, 07:25 AM
@mikey8270:
Originally posted by mikey8270
is there any way to make it show like 'You have relied to this thread' or You have not replied to this thread' somewhere on the showthread page to everybody except guests?
Sorry this can't be done, because at the moment thread is displayed, vbulletin does not save the thread repliers info in a variable. If did, this would be possible.

You have to make an SQL query beforehand, to get if visitor is a thread replier and save the result in a variable. Then you can use this variable in your conditional in this hack to achieve what you wanted..

@g-force2k2:
anways i get the infamous 6==6 as stated in the past posts...
I would say your conditional syntax may be wrong.

For example if you wrote it as:
[[($bbuserinfo[userid]==1)]] TEXT GOES HERE [[($bbuserinfo[userid]==1)]]

it looks good but it is not. Please notice the closing tag lacks / sign. So it should be:
[[($bbuserinfo[userid]==1)]] TEXT GOES HERE [[/($bbuserinfo[userid]==1)]]

If this is not your problem, try to make this change:
find:

return "<!-- BEGIN TEMPLATE: $templatename -->\n$template\n<!-- END TEMPLATE: $templatename -->";

And replace it as:

return "<!-- BEGIN TEMPLATE: $templatename -->\n".advanced_templates($template)."\n<!-- END TEMPLATE: $templatename -->";

If this also not fixes it, can you please post here the conditional you used (please copy paste from the template) and also function gettemplate after you applied the hack.. Let me check..

zonegray
10-05-2002, 11:26 AM
g-force2k2 - I had the same problem... template debug was turned off, but I still saw the 6==6 stuff, I even added the other hack that Logi mentioned, and that didn't work. Eventually I reviewed the installation with a gun to my head, and finally found the typo.

My mistake was that half the edits went to the wrong server, due to a peculiarity of ssh.com's Secure File Transfer that I used while editing.

Logician
10-05-2002, 12:19 PM
Originally posted by zonegray
My mistake was that half the edits went to the wrong server, due to a peculiarity of ssh.com's Secure File Transfer that I used while editing.
:)

Babylon
10-07-2002, 09:26 AM
Hi Logician :)

Have to say that this hack is amazing! Finally gives me the full flexibility in my templates that I've been looking for! Great work :)

I was reading the previous posts in this thread (particularly the third page) and came up with a slightly different installation alternative which allows people to have the "Add template name in comments" option on, and makes the script slightly more optimised (using the info you said on the third page) and still makes installation only 2 steps :)

(I was very happy when reading through the hack installation details first time round to find there were only 2 installation steps as I was trying to install about 2 hacks at the time :/ )

Back to what I was talking about:

Instead of step one being:


1- Edit admin/functions.php, find
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
return $template;
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Replace it AS:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
return advanced_templates($template);
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Change step one to:


1- Edit admin/functions.php, find
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
if ($gethtmlcomments and $addtemplatename) {
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Replace it AS:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
if (substr_count($template,'[[/(')>=1) {
$template = advanced_templates($template);
}
if ($gethtmlcomments and $addtemplatename) {
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Logician
10-07-2002, 09:39 AM
Originally posted by Babylon
I was reading the previous posts in this thread (particularly the third page) and came up with a slightly different installation alternative which allows people to have the "Add template name in comments" option on, and makes the script slightly more optimised (using the info you said on the third page) and still makes installation only 2 steps :)

Yes Babylon, your solution is quite good which solves 2 issues in 1 step. ;)

In fact I should have already updated the instructions but I have little time and too many hacks to support nowadays.. Fortunately, hack thread is not yet too long, modification is not so crucial and the users of this hack are usually power-users (like yourself) who can achieve things without my help. :)

Anyway, I will hopefully update them very soon..

Babylon
10-07-2002, 06:06 PM
Very true :) Well, again, excellent hack! JUst trying to think of the best things to use it for, but there's just so much i wanna change in my forum now!

This is only my second post ya know! :)

Wildthinks
10-07-2002, 06:22 PM
Hi Logician,

i have try insert "Hi $bbuserinfo[username],", but display is that one and not "Hi Wildthinks" or so on... any Hints or impossible?

Martin CX
10-08-2002, 12:15 AM
Originally posted by Wildthinks
i have try insert "Hi $bbuserinfo[username],", but display is that one and not "Hi Wildthinks" or so on... any Hints or impossible? This hasn't really anything to do with the hack (or has it?) but use $username if you want to display the users username.

Logician
10-08-2002, 10:15 AM
Originally posted by Wildthinks
Hi Logician,

i have try insert "Hi $bbuserinfo[username],", but display is that one and not "Hi Wildthinks" or so on... any Hints or impossible?
It should and I tested it and it does here..

Can you give more info? What was your exact conditional and in which template did you use it?

Devil-GOD
10-08-2002, 11:42 AM
great
***install***

Wildthinks
10-09-2002, 08:19 AM
Originally posted by Logician

It should and I tested it and it does here..

Can you give more info? What was your exact conditional and in which template did you use it?
sorry wrong thread... the problem is in the announcement script ...
i wrote there ... Sorry...

Colon33
10-13-2002, 02:59 AM
I run vb 2.2.6 right now, and was always afraid to update to 2.2.7 and then to 2.2.8 because many people said there templates messed up and hacks messed up... is it safe to upgrade a board that has alot of template changes and runs a whole RPG setup complete with itemshop and everything? Cause i really want to install this hack to add more atmosphere to an already interactive board.

Logician
10-13-2002, 08:43 AM
Originally posted by Colon33
I run vb 2.2.6 right now, and was always afraid to update to 2.2.7 and then to 2.2.8 because many people said there templates messed up and hacks messed up... is it safe to upgrade a board that has alot of template changes and runs a whole RPG setup complete with itemshop and everything? Cause i really want to install this hack to add more atmosphere to an already interactive board.
Colon33, upgrading the board does not mess the templates but if you have hacks applied you'll lose them and need to reapply. So it may be a problem for you if you have a lot of hacks.

But the good news is this hack does not require 2.2.8 to work. I think I mentioned in the first message of the thread as well: It works with all vb versions. I coded it in 2.2.6 and my board is still 2.2.6 and it has no problems.. ;)

So go ahead and install it..

Dean C
10-14-2002, 06:20 PM
whats the conditional for forumid?

Regards

- miSt

Logician
10-15-2002, 09:53 AM
Originally posted by Mist
whats the conditional for forumid?

It may change according to the template you are applying but usually $forumid will do the trick. You can check the template code (or script code that calls that template) to see if another variable is used or not (like $threadinfo[forumid])

Dean C
10-15-2002, 03:39 PM
ill do it forumdisplay .

so what will be the conditional code i can use in the template

i.e. the one in " [ "'s

- mISt

Logician
10-16-2002, 09:17 AM
Originally posted by Mist
ill do it forumdisplay .

so what will be the conditional code i can use in the template

i.e. the one in " [ "'s

- mISt
($forumid==X)

Dean C
10-16-2002, 03:44 PM
so if i put this in my forumdisplay template it would only apply to the forum whose id is 2


[(forumid==2)]
Test
[/(forumid==2]

?

Regards

- miSt

Logician
10-17-2002, 11:55 AM
Originally posted by Mist
so if i put this in my forumdisplay template it would only apply to the forum whose id is 2


[(forumid==2)]
Test
[/(forumid==2]


Yes it should.. However dont forget the closing ) in the second line..

Dean C
10-17-2002, 05:31 PM
hehe oops

Right one more question... can you have a global conditional as well as single conditionals

Cuz im my forumdisplay template i want to have one template for a specific forum and i want the default template to apply for the rest... Im sick of doing this with extra styles and assigning a forum a specific style set as it gets too confusing

I want to use something like this in my forumdisplay template:


[(forumid==2)]
This will be the template for the forums whose id is 2
[/(forumid==2)]

[(forumid==Restofforums)]
This will be the template for all other forums that haven't got a conditional assigned to them
[/(forumid==Restofforums)]


_______

Any ideas?

Regards

- miSt

Logician
10-17-2002, 06:03 PM
Originally posted by Mist
Cuz im my forumdisplay template i want to have one template for a specific forum and i want the default template to apply for the rest... Im sick of doing this with extra styles and assigning a forum a specific style set as it gets too confusing

What you need is this:


[[($forumid==2)]]
This will be the template for the forums whose id is 2
[[/($forumid==2)]]
[[($forumid!=2)]]
This will be the template for the forums whose id is NOT 2
[[/($forumid!=2)]]

Dean C
10-18-2002, 05:24 PM
lol why didn't i think of the " != "

Thanks buddy

- miSt

HappyPike
10-18-2002, 07:50 PM
hey Logician,

Can this hack be use to hide or show certain features such as avatars depending on current server load? If yes, what's the conditionals for that?

Thanks! This is a really useful hack!

Logician
10-18-2002, 08:03 PM
Originally posted by HappyPike

Can this hack be use to hide or show certain features such as avatars depending on current server load? If yes, what's the conditionals for that?

As it is, no.

But if you can add another hack which will assign the server load (or anything you like) to a global variable (like in global.php) then yes it can. After you assign the variable value, you should edit postbit template and find the avatar variable (was it $post[avatar] ?) and replace it with this code:


[[($yourvariable<x)]]
$post[avatar]
[[/($yourvariable<x)]]

Now avatars would be displayed only when $yourvariable is less than x.

EDIT: BTW. do not forget that this may not help much since the template modifications is just about the visual design. That is, your db would be still queried for the avatar in this example but just not displayed to the end user inside your template. So it wouldnt help decreasing server load much.. just the bandwidth maybe :)

John
10-19-2002, 06:19 PM
Logician - you genius!!

You would not believe the work this hack has saved me, and I installed it in under a minute!

Thanks!

pool-werbung
10-27-2002, 07:18 PM
Can i use a condition of the ip of the user? Is there a var that in it is the user-ip?

NTLDR
10-27-2002, 07:45 PM
You could try using:

$HTTP_SERVER_VARS[REMOTE_ADDR]

No idea if it will work, or if any of the $HTTP variables will work with this hack without modification. I'm sure Logician can shed some light though ;)

Logician
10-27-2002, 10:19 PM
NTDLR's method should work.. The hack is compatible with ALL variables in the memory so if I guess $HTTP_SERVER_VARS[REMOTE_ADDR] will work..

Also vb saves user's IP address in "$ipaddress" variable in global.php, so $ipaddress should work too.

However I'm sure you are well aware that IP address is not a good mainstay for conditionals since many users have dynamic IP.

JakeC
10-29-2002, 02:49 AM
Excellent Hack! Now even I can feel like a power user!!

JakeC

Bandit
11-02-2002, 02:05 AM
I installed this hack and all of a sudden my forums started to show the default templates for every style I have. The template is still the same (in the user cp), but my forums just show the default one... I tried uploading the old functions.php but it did not fix the problem. Any ideas??

Logician
11-02-2002, 07:21 AM
Originally posted by Bandit
I installed this hack and all of a sudden my forums started to show the default templates for every style I have. The template is still the same (in the user cp), but my forums just show the default one... I tried uploading the old functions.php but it did not fix the problem. Any ideas??
The hack is quite simple with 2 changes in functions.php. No template editing, no db alterations and no other modifications in any other vb file. Therefore if you replace the functions.php with the older one, it's impossible for the hack to affect your board in anyway. It will be successfully removed. Therefore your problem doesnt look like related to the hack.

And actually I cant think a reason the hack will behave like this either. Technically the hack does not interfere the loading of the template, it just interferes when the already-loaded template is returned to the vb so the behaviour you describe does not fit its algorithm..

I dont know how I can help you about this problem you encountered. I suspect you might applied a step wrong while installing and changed a section which you shouldn't touch. However this still does not explain how come you have the same problem when you reverted the function.php though..

Okiewan
11-16-2002, 07:40 PM
I can't believe this hack isn't hack of the year, no doubt the most powerful I've seen, excellent work!

Please excuse the noob question, but...

1) I understand the conditional formating
2) I'm not sure where to place the conditional in the template.
3) Here's the goal:

Usergroup X can not see the "Change Style" portion of their user options.
Usergroups A, b and C can.

4) I assume a copy (modify options2) of modify options needs to be made, then a conditional put in the original. If usergroup x goes to modify, the conditional sends them to the copy ("modify options2")

Someone help me out with this?
Thanks!

Logician
11-16-2002, 08:26 PM
Usergroup X can not see the "Change Style" portion of their user options.
Usergroups A, b and C can.


it's easier than what you think: ;)

edit template "modifyoptions" and find:

$stylecell


Replace it as:


[[($bbuserinfo[usergroupid]!=X)]]
$stylecell
[[/($bbuserinfo[usergroupid]!=X)]]


Enjoy..

Okiewan
11-16-2002, 08:39 PM
Oh man, that's sweet :)
Thanks! Again, great hack.

N9ne
11-23-2002, 10:42 AM
I voted for the warning system hack for the HOTM, but that's because I hadn't installed this...but now that I have, I vote this hack of the millenium, Logician, you've done one great job here! This tiny change to some code adds so much functionality to my forum!

Just a thumbs up for this, this is truly brilliant, well done.

N9ne
11-25-2002, 06:09 PM
Question: Can the ismoderator function somehow be used?

Logician
11-26-2002, 11:50 AM
Originally posted by N9ne
Question: Can the ismoderator function somehow be used?
give it a try but I'd say no. Conditionals are not designed to run functions and ismoderator is a function that needs to be run to produce a result. Conditional works with variables..

danrak
12-01-2002, 04:36 PM
How do I set it up so a group of IPs can see a message? For example say I want everyone from 192.168.1.x to see a message, or say IPs from 192.168.1.x and 255.255.255.x to see a message?

Logician
12-02-2002, 09:38 AM
Originally posted by danrak
How do I set it up so a group of IPs can see a message? For example say I want everyone from 192.168.1.x to see a message, or say IPs from 192.168.1.x and 255.255.255.x to see a message?
I neither test it, nor sure if it works but give it a try:

[[(substr($REMOTE_ADDR, 0, strlen(X))==192.168.1)]]
your template content for users whose IP is starting with 192.168.1
[[/(substr($REMOTE_ADDR, 0, strlen(X))==192.168.1)]]

Replace X with the character length of IP you used at the end.
For example:
if you use "192.168.1.255" X is 13
if you use "192.168.1" X is 9
if you use "192.168" X is 7
if you use "192" X is 3 etc.

Karmulian
12-08-2002, 09:34 PM
I installed this hack on vbb2.2.9

ever since i have been getting PH memory leaks
and over 60mb's worth of leak is somethig to worry about

when i removed (quoted out) the announcements funtion in /admin/functions.php the errors stopped

anything you can guess at that would be causing this problem?

PS - i really love thjis hack and have been using it loads.. until the errorsa started.. i would like to use it again

Logician
12-08-2002, 10:59 PM
Originally posted by Karmulian
when i removed (quoted out) the announcements funtion in /admin/functions.php the errors stopped

what announcement function? Do you mean this hack or Dynamic Announcement's hack?

Sadie Frost
12-22-2002, 05:09 AM
Would there be a way to use this to make a forum appear in a different style for different users? :)

Logician
12-22-2002, 07:18 PM
Originally posted by Sadie Frost
Would there be a way to use this to make a forum appear in a different style for different users? :)
Although the answer is yes, it would be easier to handle this with an other small hack so I'll give you this solution instead of this hack's solution: :)

Edit global.php, find:
$getforum=verifyid('forum',$forumid,0,1);
if ($getforum['styleoverride']==1 or $bbuserinfo['styleid']<2) {
$codestyleid=$getforum['styleid'];
}


After that add:
(If you want to apply different style set for specific user)

if ($bbuserinfo['userid']==X AND $forumid==Z) {$codestyleid=Y;}


(If you want to apply different style set for specific usergroup)

if ($bbuserinfo['usergroupid']==X AND $forumid==Z) {$codestyleid=Y;}


Replace X with userid (first code), usergroupid(secondcode) while you replace Y with your style id and Z with the forumid.

It works like this: If user is X and he visited forum Z, his style will change to Y

Boofo
12-25-2002, 02:00 PM
Sinan, is there a way to only have the "Edit Post" button appear to those who "candeleteposts" with this hacK? I have been working on this for 2 days now trying to figure out the right variable to work with this. Can it be done or am I missing something? If not with this hack, is there a way this can be done another way? Great hack, buddy! ;)

Logician
12-26-2002, 08:25 AM
Originally posted by Boofo
Sinan, is there a way to only have the "Edit Post" button appear to those who "candeleteposts" with this hacK? I have been working on this for 2 days now trying to figure out the right variable to work with this. Can it be done or am I missing something? If not with this hack, is there a way this can be done another way? Great hack, buddy! ;)
This should work:
Edit postbit template, find:

<a href="editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]"><img src="{imagesfolder}/edit.gif" border="0" alt="Edit/Delete Message"></a>

Replace it as:

[[($post[userid]==$bbuserinfo[userid] or ($bbuserinfo[usergroupid]=="5" or $bbuserinfo[usergroupid]=="6" or $bbuserinfo[usergroupid]=="7"))]]
<a href="editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]"><img src="{imagesfolder}/edit.gif" border="0" alt="Edit/Delete Message"></a>
[[/($post[userid]==$bbuserinfo[userid] or ($bbuserinfo[usergroupid]=="5" or $bbuserinfo[usergroupid]=="6" or $bbuserinfo[usergroupid]=="7"))]]

a43079
12-26-2002, 09:35 AM
noce hack

Boofo
12-26-2002, 10:01 AM
Thanks, Sinan. I have a hack that does that already. What i am looking for is to have it not show up to anyone besides the admin and Supermod unless they are either the poster of the message or a mod that has edit rights to that message. Not all of my mods can edit messages everywhere on the board. I tried the ismoderator variable and it didn't work. Is there another way around this?

I think I will take the hack out and replace it with your code. :)

Originally posted by Logician

This should work:
Edit postbit template, find:

<a href="editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]"><img src="https://vborg.vbsupport.ru/images/edit.gif" border="0" alt="Edit/Delete Message"></a>

Replace it as:

[[($post[userid]==$bbuserinfo[userid] or ($bbuserinfo[usergroupid]=="5" or $bbuserinfo[usergroupid]=="6" or $bbuserinfo[usergroupid]=="7"))]]
<a href="editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]"><img src="https://vborg.vbsupport.ru/images/edit.gif" border="0" alt="Edit/Delete Message"></a>
[[/($post[userid]==$bbuserinfo[userid] or ($bbuserinfo[usergroupid]=="5" or $bbuserinfo[usergroupid]=="6" or $bbuserinfo[usergroupid]=="7"))]]

Sadie Frost
12-30-2002, 07:30 PM
Thank you Logician :)

Martin CX
01-02-2003, 10:11 PM
This is an extremely fine hack.

Is there some "CanPostReply" variable, I can use to hide the "quote" and "post reply"-buttons if a user isn't allowed to post in a thread (either because it is locked, oe because of their user group).

Highlander
01-06-2003, 08:16 AM
i just used your similar hacks in march 2002 .. and it was very great.... i might install this also !..

great work.. the should make you to be one of the master VB code designers !

arracing
01-21-2003, 03:26 PM
how can i make it so that my top_stats button still shows but will tell a guest he needs to register the same way the forum defaults do when you set permissions to have guests not see certain forums?

I dont want guests to be able to see my forum stats.

Logician
01-21-2003, 04:28 PM
Originally posted by arracing
how can i make it so that my top_stats button still shows but will tell a guest he needs to register the same way the forum defaults do when you set permissions to have guests not see certain forums?

Which page or script does your "top_stats" page link to? It is not default vb so should be another hack (eg. vb stats)?

arracing
01-21-2003, 09:10 PM
the top_stats button links to vbstats.php
Its a hack i got off these forums. my website is www.ar-racing.com

Mike11212
01-21-2003, 09:38 PM
I am having trouble with the hack.
I don't want UserGroup 19 not to see a certin html code in the footer template
so I added
-----------
[[($bbuserinfo[usergroupid]==4 OR[usergroupid]==17 OR[usergroupid]==18 OR[usergroupid]==9 OR[usergroupid]==8 OR[usergroupid]==2 OR[usergroupid]==1 OR[usergroupid]==3 OR[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

HTML CODE HERE

[[/($bbuserinfo[usergroupid]==4 OR[usergroupid]==17 OR[usergroupid]==18 OR[usergroupid]==9 OR[usergroupid]==8 OR[usergroupid]==2 OR[usergroupid]==1 OR[usergroupid]==3 OR[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]
---------------------------

But it hides the html code from everyone

Boofo
01-21-2003, 09:48 PM
Then why don't you just use this and save some code?

[[($bbuserinfo[usergroupid]!=19)]]

HTML CODE HERE

[[/($bbuserinfo[usergroupid]!=19)]]

and you need to add spaces after the OR in your code. ;)

Boofo
01-21-2003, 09:53 PM
This:

[[($bbuserinfo[usergroupid]==4 OR[usergroupid]==17 OR[usergroupid]==18 OR[usergroupid]==9 OR[usergroupid]==8 OR[usergroupid]==2 OR[usergroupid]==1 OR[usergroupid]==3 OR[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

HTML CODE HERE

[[/($bbuserinfo[usergroupid]==4 OR[usergroupid]==17 OR[usergroupid]==18 OR[usergroupid]==9 OR[usergroupid]==8 OR[usergroupid]==2 OR[usergroupid]==1 OR[usergroupid]==3 OR[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

should be this:

[[($bbuserinfo[usergroupid]==4 OR $bbuserinfo[usergroupid]==17 OR $bbuserinfo[usergroupid]==18 OR $bbuserinfo[usergroupid]==9 OR $bbuserinfo[usergroupid]==8 OR $bbuserinfo[usergroupid]==2 OR $bbuserinfo[usergroupid]==1 OR $bbuserinfo[usergroupid]==3 OR $bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

HTML CODE HERE

[[/($bbuserinfo[usergroupid]==4 OR $bbuserinfo[usergroupid]==17 OR $bbuserinfo[usergroupid]==18 OR $bbuserinfo[usergroupid]==9 OR $bbuserinfo[usergroupid]==8 OR $bbuserinfo[usergroupid]==2 OR $bbuserinfo[usergroupid]==1 OR $bbuserinfo[usergroupid]==3 OR $bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

Mike11212
01-21-2003, 10:12 PM
thank you very very much :)

Boofo
01-21-2003, 10:15 PM
You're welcome. Just curious, which code are you using? The first one I posted or the second one?

Mike11212
01-21-2003, 10:22 PM
The secound code because because I want to hide an add for 1 user group but have the rest see it.

Mike11212
01-21-2003, 10:24 PM
My visitors have said they would be interesting in paying to visit the site. So I said I would offer an ads free version of the site for those who pay. Lets see if they do

Boofo
01-21-2003, 10:27 PM
Originally posted by Mike11212
The second code because because I want to hide an add for 1 user group but have the rest see it.

Then use the first code and change the 19 to the number of the group you want to hide it from. The != means is not equal to.

Mike11212
01-21-2003, 10:44 PM
I want to hide it from every group except 19

JakeC
01-22-2003, 12:57 AM
What would be the correct variable for new private messages? I know that I use this to call the number of new messages: $unreadpm[messages]. I would like to simply use this hack to turn text red when there are more than 0 new messages. Thanks in advance.

JakeC

Boofo
01-22-2003, 02:12 AM
Originally posted by Mike11212
I want to hide it from every group except 19

Then use this:

[[($bbuserinfo[usergroupid]==19)]]

HTML CODE HERE

[[/($bbuserinfo[usergroupid]==19)]]

Boofo
01-22-2003, 02:16 AM
Originally posted by JakeC
What would be the correct variable for new private messages? I know that I use this to call the number of new messages: $unreadpm[messages]. I would like to simply use this hack to turn text red when there are more than 0 new messages. Thanks in advance.

JakeC

Try this and let me know if it works.

[[($unreadpm[messages]!=0)]]

HTML CODE HERE

[[/($unreadpm[messages]!=0)]]

arracing
01-23-2003, 08:41 PM
wont someone please help me out with my question. What code should I use to make unregistered user group not able to access the top_stats link to vbstats.php. I want them to still be able to see the button but just when they click on it, it takes them to the user not registered page, please log in screen.

Im not sure what template to put this code in as it needs to be always used say if they are in another forum and are unregisterd, i still want them to not be able to access vbstats. And I need the code for this too.

Thanks

JakeC
01-24-2003, 12:23 AM
Boofo,

It worked with >0 . I tried it with the !=0 and it didn't work. Thanks for pointing me in the right direction.

JakeC

Logician
01-24-2003, 06:12 AM
Originally posted by arracing
wont someone please help me out with my question. What code should I use to make unregistered user group not able to access the top_stats link to vbstats.php. I want them to still be able to see the button but just when they click on it, it takes them to the user not registered page, please log in screen.

This hack allows you to display/hide your stats button but this is not what you want. To achieve your goal, you have to either know the template your stats file display or edit the file vbstats.php, find

require('./global.php');
and after that add:

if ($bbuserinfo[userid]==0)
{
show_nopermission();
}

arracing
01-24-2003, 02:58 PM
well in stead of userid how about usergroupid to block whole groups from seeing it. Also please double check me, is it usergroupid or just usergroups? Also I want to include more than 1 usergroupid in the list of people not being able to see the stats. I try and put numbers like

if ($bbuserinfo[usergroupid]==1,3,4,11,12)
{
show_nopermission();
}

but that gives me an error.

What am i doing wrong.

I know if i use the code below it works fine to block guests.

if ($bbuserinfo[usergroupid]==1)
{
show_nopermission();
}

Boofo
01-24-2003, 03:07 PM
Originally posted by arracing
well in stead of userid how about usergroupid to block whole groups from seeing it. Also please double check me, is it usergroupid or just usergroups? Also I want to include more than 1 usergroupid in the list of people not being able to see the stats. I try and put numbers like

if ($bbuserinfo[usergroupid]==1,3,4,11,12)
{
show_nopermission();
}

but that gives me an error.

What am i doing wrong.

I know if i use the code below it works fine to block guests.

if ($bbuserinfo[usergroupid]==1)
{
show_nopermission();
}

Change this:

if ($bbuserinfo[usergroupid]==1,3,4,11,12)
{
show_nopermission();
}

To this:

if (in_array($bbuserinfo['usergroupid'], array(1,3,4,11,12))) {
show_nopermission();
}

Logician
01-24-2003, 03:25 PM
Originally posted by arracing
well in stead of userid how about usergroupid to block whole groups from seeing it.

You asked to stop unregistered usergroup's access and the code I gave does exactly this.. give it a try..

Logik
01-26-2003, 01:44 AM
This is a wonderful hack. Thanks Logician ;)

Logik
01-27-2003, 09:33 PM
This is a outstanding hack. It basically lets you use PHP in your templates. I believe everyone should install this. Would make hacking ALOT easier.

lowtaxbaby
01-28-2003, 07:20 AM
While the example in the text file worked flawlessly (the code that goes in forumhome), whenever I attempt to put the code inside postbit, it simply prints out the code itself and completely ignores it. For example, if I put:

[[($bbuserinfo[usergroupid]==6)]]
Hello
[[/($bbuserinfo[usergroupid]==6)]]

It doesn't print out "Hello," but it prints out that entire code. Is there a switch or something somewhere that I have to turn off or on? I'm not good with vB, so any help would be most appreciated.

Thanks!

Logician
01-28-2003, 10:31 AM
Originally posted by lowtaxbaby
While the example in the text file worked flawlessly (the code that goes in forumhome), whenever I attempt to put the code inside postbit, it simply prints out the code itself and completely ignores it. For example, if I put:

[[($bbuserinfo[usergroupid]==6)]]
Hello
[[/($bbuserinfo[usergroupid]==6)]]

It doesn't print out "Hello," but it prints out that entire code. Is there a switch or something somewhere that I have to turn off or on? I'm not good with vB, so any help would be most appreciated.

Thanks!
It's supposed to work in all templates including postbit. Actually I have tested the conditional you referred above in my postbit now and it works ok here. I'm not sure if it is interfereing with another hack in your board or not? I can try to understand your problem if I have access to your admin cp but other than that I'm clueless.

Boofo
01-28-2003, 03:23 PM
Originally posted by lowtaxbaby
While the example in the text file worked flawlessly (the code that goes in forumhome), whenever I attempt to put the code inside postbit, it simply prints out the code itself and completely ignores it. For example, if I put:

[[($bbuserinfo[usergroupid]==6)]]
Hello
[[/($bbuserinfo[usergroupid]==6)]]

It doesn't print out "Hello," but it prints out that entire code. Is there a switch or something somewhere that I have to turn off or on? I'm not good with vB, so any help would be most appreciated.

Thanks!

Where exactly are you trying to insert the code in the postbit?

lowtaxbaby
01-28-2003, 11:09 PM
We just downgraded back to version 2.2.6, and it works fine now. So sorry for posting that prematurely and thanks for the help!

Boofo
01-28-2003, 11:12 PM
What version were you running where you had problems? I am running 2.2.9 and it works fine.

Logik
01-28-2003, 11:13 PM
It should work for all versions. Works for my 2.2.9.. :)

Boofo
01-28-2003, 11:19 PM
I don't know how I ever got along without this hack. I think I hack my templates more than I do my php files anymore. :)

Logician
01-29-2003, 08:31 AM
Originally posted by lowtaxbaby
We just downgraded back to version 2.2.6, and it works fine now. So sorry for posting that prematurely and thanks for the help!
As stated by Logik and Boofo, hack should work in newer versions too. So I believe you might have forgotten to reapply the hack after you upgraded your board?

LanciaStratos
02-12-2003, 03:30 PM
Awesome hack, Logician! Thank you so much! You should be on the vB dev team! :) I'm already making use of conditional templates by showing a special message to guests in my header, encouraging them to join. I'm also making use of it in my headinclude template, so that pop-up advertising code is only inserted for guests, but not members! :cool:

I know that you would rather not answer questions about creating conditionals, but I would just like confirmation on whether or not this is possible... Can a conditional be created so that it displays the code only once every 12 hours per visitor?

Logician
02-12-2003, 07:08 PM
Originally posted by LanciaStratos
I know that you would rather not answer questions about creating conditionals, but I would just like confirmation on whether or not this is possible... Can a conditional be created so that it displays the code only once every 12 hours per visitor?
I'm not sure if I understand correctly the condition you want to set? If you want to show the text within certain hours, this can help:
[[(date("H", time())>0 AND date("H", time())<13)]]
condition
[[/(date("H", time())>0 AND date("H", time())<13)]]
This will apply when time is between 00.00 to 12.00 (server time).

LanciaStratos
02-13-2003, 09:20 PM
Originally posted by Logician

I'm not sure if I understand correctly the condition you want to set? If you want to show the text within certain hours, this can help:
[[(date("H", time())>0 AND date("H", time())<13)]]
condition
[[/(date("H", time())>0 AND date("H", time())<13)]]
This will apply when time is between 00.00 to 12.00 (server time). No, that's not exactly what I'm wanting to accomplish. Thanks for your help, but I just realized that I won't be able to pull off my desired effect without cookies. :ermm:

Dominick
02-13-2003, 09:21 PM
does this hack work with vbhome lite?

here is my intended result. stop me at the point where I screwed up...

in the index.php for vbhome lite
I added forumid to this select statement...

$articlebits = '';
$articlemaxnumber = iif ( $articlemax!=0 , 'LIMIT ' . $articlemax , '' );
$articles = $DB_site->query("
SELECT thread.threadid,thread.title,thread.lastpost,threa d.forumid,thread.rep\lycount,thread.postusername,t hread.postuserid,
thread.lastposter,thread.dateline,thread.views,pos t.pagetext as pagetext

that should pull the forumid so I can use it... no?

so then in the aritcle bit of vbhome lite I put in

[[($articlebits[thread.forumid='3'])]]foo[[(/$articlebits[thread.forumid='3'])]]

I have tried numerous concatenations of articlebits articles article as such. I cant figure it out. mostly because Im newbie to all of this... any help? is this possible?

Slynderdale
02-13-2003, 10:20 PM
If your looking for a similar hack like this but works in posts as a vB Code, try here:

https://vborg.vbsupport.ru/showthread.php?s=&threadid=48492

Edgemyster
02-18-2003, 08:29 PM
Logician,

The hack is awesome and works (in 2.2.9) so far ... but this is the effect I'm trying to achieve and was hoping you might offer some insight:

I'd like to show certain data in a template on "X" date and show alternative data in a template if the current date is not "X".

Any hints?

Logician
02-18-2003, 08:42 PM
Originally posted by Edgemyster
Logician,

The hack is awesome and works (in 2.2.9) so far ... but this is the effect I'm trying to achieve and was hoping you might offer some insight:

I'd like to show certain data in a template on "X" date and show alternative data in a template if the current date is not "X".

Any hints?
[[(date("m.d.Y")=="02.19.2003")]]
template content to display if date is 02.19.2003 (server time!)
[[/(date("m.d.Y")=="02.19.2003")]]
[[(date("m.d.Y")!="02.19.2003")]]
template content to display if date is NOT 02.19.2003 (server time!)
[[/(date("m.d.Y")!="02.19.2003")]]

bensonfactor
02-19-2003, 02:15 AM
Something is up, it isn't working it is only printing out the lines and not restricting anything.

Running 2.2.9, somewhat modified, it was working earlier.

Logician
02-19-2003, 05:53 AM
try to reapply.. a recent hack might have overwrited the hack somehow..

bensonfactor
02-21-2003, 06:19 PM
It was because I was putting the first part after not before the code.

Works now. Thanks.

sonic3d
02-27-2003, 12:02 AM
can u use this in a postbit?
meaning some1 already posted something and use a condition in the post?

l8er
sonic

Boofo
02-27-2003, 12:06 AM
I use it there for all sorts of things. ;)

Logician
02-27-2003, 07:01 AM
Originally posted by sonic3d
can u use this in a postbit?
meaning some1 already posted something and use a condition in the post?

With this hack you can customize the postbit template like other templates. However only admin can do it so if you want your posters to use conditionals in their posts, this hack is not for that. Check a few post above for Slynderdale's post about a similiar hack though. I don't know how it works but it may be something you are looking for..

Kars10
03-01-2003, 02:01 PM
This is the best hack ive installed for a long time!!!

Thank you so much logician!!
/me klicks install!

Gutspiller
03-15-2003, 11:32 PM
I don't understand. So I have to use commands to get it to work? Well if I just want an entire catagory to change for all users, it would probably be easier to just create a new template and apply it to that catagory instead of using this hack right?

JakeC
03-16-2003, 12:56 AM
Have there been any thought on what will happen when we go to 3.0? Should the same basic hack work in 3.0? How do you all plan on making the switch, if you do? Thanks

Jake

Slynderdale
03-16-2003, 03:35 AM
Yesterday at 09:56 PM JakeC said this in Post #147 (https://vborg.vbsupport.ru/showthread.php?postid=367110#post367110)
Have there been any thought on what will happen when we go to 3.0? Should the same basic hack work in 3.0? How do you all plan on making the switch, if you do? Thanks

Jake



Hmm by what i read on the forum, 3.0 already supports it.

Logician
03-16-2003, 07:35 AM
Today at 03:32 AM Gutspiller said this in Post #146 (https://vborg.vbsupport.ru/showthread.php?postid=367076#post367076)
I don't understand. So I have to use commands to get it to work? Well if I just want an entire catagory to change for all users, it would probably be easier to just create a new template and apply it to that catagory instead of using this hack right?
that is right..

Have there been any thought on what will happen when we go to 3.0? Should the same basic hack work in 3.0? How do you all plan on making the switch, if you do? Thanks

VB 3 is announced to have some sort of "conditional" concept. So I believe this hack will be obsolete when vb3 is released. However I'm not sure if conditional concept of vb3 will be same with this hack's. Obviously the syntax would be different. But hopefully it is only the syntax that will be different. For instance it may some other restrictions like 1 conditional per template etc. (which this hack does not have). We'll see when it's released.

Slynderdale
03-16-2003, 08:13 AM
Today at 04:35 AM Logician said this in Post #149 (https://vborg.vbsupport.ru/showthread.php?postid=367225#post367225)

that is right..


VB 3 is announced to have some sort of "conditional" concept. So I believe this hack will be obsolete when vb3 is released. However I'm not sure if conditional concept of vb3 will be same with this hack's. Obviously the syntax would be different. But hopefully it is only the syntax that will be different. For instance it may some other restrictions like 1 conditional per template etc. (which this hack does not have). We'll see when it's released.


The vBulletin 3.0 one supports multiple conditionals and there syntax is:

<if condition="condition">
// stuff
<else />
// stuff
</if>

example:

<table>
<tr>
<if condition="$vboptions['$vbversion'] == 3.0">
<td>vB 3.0 is here!</td>
<else />
<td>Still waiting...</td>
</if>
</tr></table>

JakeC
03-16-2003, 12:37 PM
Ok, thanks. Kind of a shame. This has to be the most clever hack to come out and I hate to see it gobbled up. I would be happy to see all my other hacks incorporated, but not this one. Thanks for your work getting this out to us logician!

JakeC

Mr. Brian
03-16-2003, 04:01 PM
I encountered some problems here..

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/soccerwi/public_html/forum/admin/functions.php on line 860

Fatal error: Call to undefined function: vbsetcookie() in /home/soccerwi/public_html/forum/admin/sessions.php on line 183


Hope someone can help..

Thanks in advance.

Mr. Brian
03-16-2003, 06:24 PM
*Bump*

Today at 02:01 AM Matthew Lam said this in Post #152 (https://vborg.vbsupport.ru/showthread.php?postid=367527#post367527)
I encountered some problems here..

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/xxxxx/public_html/forum/admin/functions.php on line 860

Fatal error: Call to undefined function: vbsetcookie() in /home/xxxxx/public_html/forum/admin/sessions.php on line 183


Hope someone can help..

Thanks in advance.

Logician
03-17-2003, 06:16 AM
Yesterday at 08:01 PM Matthew Lam said this in Post #152 (https://vborg.vbsupport.ru/showthread.php?postid=367527#post367527)
I encountered some problems here..

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/soccerwi/public_html/forum/admin/functions.php on line 860

Fatal error: Call to undefined function: vbsetcookie() in /home/soccerwi/public_html/forum/admin/sessions.php on line 183


Hope someone can help..

Thanks in advance.
https://vborg.vbsupport.ru/showthread.php?postid=306036#post306036

Boofo
03-18-2003, 12:10 PM
Sinan, I have to ask. I've seen some of what they say is the conditionals for 3.0 and to tell you the truth, I don't like them as much as I do yours for this hack. Will you, by chance, be updating this for 3.0 for those of us that are used to your conditionals and the way of doing them like we are now?

Logician
03-18-2003, 06:18 PM
Sinan, I have to ask. I've seen some of what they say is the conditionals for 3.0 and to tell you the truth, I don't like them as much as I do yours for this hack. Will you, by chance, be updating this for 3.0 for those of us that are used to your conditionals and the way of doing them like we are now?
I can't say anything at the moment as I don't know the structure of vb3 conditionals. Freddie told in this thread that they are more performance friendly so we might as well used them if this proves to be true. But frankly I didnt understood its logic from his explanation so will not know the algorithm till vb is released. After seeing the algorithm, I may consider replacing it with my conditionals if their performances are similiar or a syntax translation to make it competible with my syntax if its performance is better and a conversion will be possible without affecting the performance. We'll see..

Kaelon
03-18-2003, 10:17 PM
Words cannot express the absolute amazement that I have in this extremely awesome hack. Congratulations, Logician - this is absolutely brilliant.

Kaelon

Boofo
03-18-2003, 10:19 PM
Logician is a magician. ;)

Mr. Brian
03-19-2003, 12:38 AM
Ya, I did replaced instead of add.

03-17-03 at 04:24 AM Matthew Lam said this in Post #153 (https://vborg.vbsupport.ru/showthread.php?postid=367630#post367630)
*Bump*


ob_start();
$oldlevel=error_reporting(0);
highlight_string($code);
error_reporting($oldlevel);
$buffer = ob_get_contents();
ob_end_clean();
if ($addedtags) {
$openingpos = strpos($buffer,'<?');
$closingpos = strrpos($buffer, '?');
$buffer=substr($buffer, 0, $openingpos).substr($buffer, $openingpos+5, $closingpos-($openingpos+5)).substr($buffer, $closingpos+5);
}
$buffer = str_replace(""", "\"", $buffer);
}

return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
$foundcode = str_replace("\\\"","\"",$foundcode);
return "</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" . str_replace("<br>", "", str_replace("<br />", "", $foundcode) ) . "<hr></pre></blockquote><normalfont>";
}

// ###################### Start createlists #######################
function createlists($foundlist, $type="") {
$type = iif(empty($type), $type, " type=\"$type\"");
$foundlist = str_replace("\\\"","\"",$foundlist);
if ($type) {
return "<ol$type>" . str_replace(" ","<li>", $foundlist) . "</ol>";
} else {
return "<ul>" . str_replace(" ","<li>", $foundlist) . "</ul>";
}
}

functions.php lines between 810 - 850..

thanks.. :)

Logician
03-19-2003, 06:05 AM
I say check step 1.. After you applied it, the line should look like this:


//Logician Advanced Templates Hack
if (substr_count($template,'[[/(')>=1) {$template = advanced_templates($template);}
//Logician Advanced Templates Hack
if ($gethtmlcomments and $addtemplatename) {


Not like this:

//Logician Advanced Templates Hack
if (substr_count($template,'[[/(')>=1) {$template = advanced_templates($template);}
//Logician Advanced Templates Hack if ($gethtmlcomments and $addtemplatename) {


More info here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=39142)

Kars10
03-20-2003, 07:47 PM
@ Logician, is there a way to make a condition for Forumhome Moderators?
I want to add the moderators under Forum-description like here on vb.org [moderated by: xxx, xxx, xxx].
But when the forum isnĀ“t moderated the [moderated by: xxx] is gone... is there a way to do this with this hack??

Thanks in advance
Kars

Logician
03-21-2003, 08:45 AM
Yesterday at 11:47 PM Kars10 said this in Post #161 (https://vborg.vbsupport.ru/showthread.php?postid=370157#post370157)
@ Logician, is there a way to make a condition for Forumhome Moderators?
I want to add the moderators under Forum-description like here on vb.org [moderated by: xxx, xxx, xxx].
But when the forum isn?t moderated the [moderated by: xxx] is gone... is there a way to do this with this hack??

Thanks in advance
Kars
Not tested but building up a conditional depending on $moderator[userid] variable should do the trick. eg.

[[($moderator[userid])]]
Moderated by:....
[[/($moderator[userid])]]

Kars10
03-21-2003, 08:53 AM
@ Logician, do you mean i should place this codition in forumhome_forumbit_level2_post with the userids of my moderators? Can you show me a examble, please?

Thanks
Kars

Boofo
03-21-2003, 08:57 AM
I tried that one and a few others and could never find one that worked. I ended up having to put code in the index.php to catch it. ;)

Logician
03-21-2003, 09:56 AM
Today at 12:57 PM Boofo said this in Post #164 (https://vborg.vbsupport.ru/showthread.php?postid=370520#post370520)
I tried that one and a few others and could never find one that worked. I ended up having to put code in the index.php to catch it. ;)
ok please give the code then so that Kars can use it too :)

Code hacking is a better solution in this example anyway since forumhome templates are usually long and frequently called templates. So apply the hack into the code is more performance friendly than applying into the template, especially for large traffic boards..

Kars10
03-21-2003, 10:09 AM
Thanks Logician!!
I have PM?t Boofo about that!!

Kars :)

Boofo
03-21-2003, 10:10 AM
Today at 05:56 AM Logician said this in Post #165 (https://vborg.vbsupport.ru/showthread.php?postid=370553#post370553)

ok please give the code then so that Kars can use it too :)

For you, Sinan, gladly. ;)

Code hacking is a better solution in this example anyway since forumhome templates are usually long and frequently called templates. So apply the hack into the code is more performance friendly than applying into the template, especially for large traffic boards..

I didn't know that. My forumhome templates are pretty coded up with your conditionals. I might have to take a look at some of them. Thanks. ;)

Mr. Brian
03-22-2003, 05:12 PM
Hi Logician,

Thanks for your reply, but omehow I still getting the same error.


03-19-03 at 04:05 PM Logician said this in Post #160 (https://vborg.vbsupport.ru/showthread.php?postid=369086#post369086)
I say check step 1.. After you applied it, the line should look like this:


//Logician Advanced Templates Hack
if (substr_count($template,'[[/(')>=1) {$template = advanced_templates($template);}
//Logician Advanced Templates Hack
if ($gethtmlcomments and $addtemplatename) {


Not like this:

//Logician Advanced Templates Hack
if (substr_count($template,'[[/(')>=1) {$template = advanced_templates($template);}
//Logician Advanced Templates Hack if ($gethtmlcomments and $addtemplatename) {


More info here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=39142)

Thats exactly what I did. :(

Logician
03-22-2003, 05:30 PM
Today at 09:12 PM Matthew Lam said this in Post #168 (https://vborg.vbsupport.ru/showthread.php?postid=371431#post371431)
Hi Logician,

Thanks for your reply, but omehow I still getting the same error.

You are using notepad for editing, right?

Mr. Brian
03-23-2003, 02:21 PM
Ya, last time I used to use notepad. But I've already no longer using notepad but using editplus instead. :bored:

Mr. Brian
03-23-2003, 07:17 PM
Hi Logician,

Ya, last time I used to use notepad. But I've already no longer using notepad but using editplus instead.

BTW, I'd like to take this opportunity to thanks you by keep giving support to me as whenever there's a need(s) and there's always a will from you .

Anyway, I think my forum already gone case or maybe can said close shop soon. It had been almost a week, till now still can't even figure out any anythings.. Really in a lost! :hurt:

Logician
03-23-2003, 10:20 PM
Yesterday at 11:17 PM Matthew Lam said this in Post #171 (https://vborg.vbsupport.ru/showthread.php?postid=372164#post372164)
Hi Logician,

Ya, last time I used to use notepad. But I've already no longer using notepad but using editplus instead.

BTW, I'd like to take this opportunity to thanks you by keep giving support to me as whenever there's a need(s) and there's always a will from you .

Anyway, I think my forum already gone case or maybe can said close shop soon. It had been almost a week, till now still can't even figure out any anythings.. Really in a lost! :hurt:
sorry dont have a clue then.. If this is really important hack for you and you can give me FTP and Admin CP access, I can take a look at it.

winky6
03-30-2003, 06:56 PM
:banana: I can only dream of being so creative..
Outstanding hack.
Thank You :banana: :banana:

lowtaxbaby
04-01-2003, 01:11 PM
Greetings,

First of all, this is a wonderful hack and I love you to death for it, as it's very useful. I have one quick question for you: I'm trying to make it so that a certain message is displayed to a user if they do not have a custom title. In showthread.php, I believe this is a boolean named "$avatarenabled". How would I be able to make this message appear if they do not have an avatar enabled? I tried this:

[[(!($avatarenabled))]]
You do not have an avatar enabled.
[[/(!($avatarenabled))]]

But it simply threw up:

[[(!(0))]]
You do not have an avatar enabled.
[[/(!(0))]]

What stupid error am I making here? Any help would be greatly appreciated. Once again, thank you very much!

Boofo
04-01-2003, 01:16 PM
Try this:

[[(!$avatarenabled)]]
You do not have an avatar enabled.
[[/(!$avatarenabled)]]

Logician
04-01-2003, 01:17 PM
Today at 05:11 PM lowtaxbaby said this in Post #174 (https://vborg.vbsupport.ru/showthread.php?postid=376343#post376343)
Greetings,

First of all, this is a wonderful hack and I love you to death for it, as it's very useful. I have one quick question for you: I'm trying to make it so that a certain message is displayed to a user if they do not have a custom title. In showthread.php, I believe this is a boolean named "$avatarenabled". How would I be able to make this message appear if they do not have an avatar enabled? I tried this:

[[(!($avatarenabled))]]
You do not have an avatar enabled.
[[/(!($avatarenabled))]]

But it simply threw up:

[[(!(0))]]
You do not have an avatar enabled.
[[/(!(0))]]

What stupid error am I making here? Any help would be greatly appreciated. Once again, thank you very much!
[[(!$avatarenabled)]]
You do not have an avatar enabled.
[[/(!$avatarenabled)]]
will do the trick provided that your variable is correct (I didnt check it but it seems correct according to your outcome)

Logician
04-01-2003, 01:18 PM
you are fast Bob! (and invisible) hehe

Boofo
04-01-2003, 01:23 PM
Today at 09:18 AM Logician said this in Post #177 (https://vborg.vbsupport.ru/showthread.php?postid=376349#post376349)
you are fast Bob! (and invisible) hehe

LOL Sorry about that, Sinan. Just thought I'd lend a hand. ;)

Being invisible sometimes has it's advantages. Chen taught me that trick. ;)

lowtaxbaby
04-01-2003, 01:33 PM
Today at 03:16 PM Boofo said this in Post #175 (https://vborg.vbsupport.ru/showthread.php?postid=376346#post376346)
Try this:

[[(!$avatarenabled)]]
You do not have an avatar enabled.
[[/(!$avatarenabled)]]


Thank you very much for your quick response, but apparently I have the wrong variable. Here is what I am attempting to accomplish, and if anybody could reveal which variable I am looking for, I would be forever in your debt.

What is the variable that determines if a user has a custom title or if the user simply has the default user title that shows up for X posts? That is, by default, people have their custom titles changed when they reach X posts. However, an admin can give them a custom title that does not change despite the number of posts they make.

Does anybody know what variable this is or how I could possibly find it? I'd like to make the postbit layout slightly different for people who have been given a custom title by the admins, which is why I'm asking.

Thank you very much!

Logician
04-01-2003, 04:13 PM
Today at 05:33 PM lowtaxbaby said this in Post #179 (https://vborg.vbsupport.ru/showthread.php?postid=376357#post376357)


What is the variable that determines if a user has a custom title or if the user simply has the default user title that shows up for X posts? That is, by default, people have their custom titles changed when they reach X posts. However, an admin can give them a custom title that does not change despite the number of posts they make.

if user has a custom title, variable $post[customtitle] gets value 2 and his custom title is saved in variable $post[usertitle]

so conditional is
[[($post[customtitle]==2)]]
you have a custom title which is $post[usertitle]
[[/($post[customtitle]==2)]]

Enjoy..

Just thought I'd lend a hand.
yes please be my guest anytime.. :)

Boofo
04-01-2003, 04:27 PM
How would that custom title condition work in the getinfo template (profile)?

Logician
04-01-2003, 05:04 PM
$userinfo[customtitle] $userinfo[usertitle]

Boofo
04-01-2003, 05:06 PM
Thank you. sir. ;)

I had to use ==1 to make it work, though. ==2 didn't do anything for some reason.

lowtaxbaby
04-01-2003, 06:08 PM
Today at 07:06 PM Boofo said this in Post #183 (https://vborg.vbsupport.ru/showthread.php?postid=376441#post376441)
Thank you. sir. ;)

I had to use ==1 to make it work, though. ==2 didn't do anything for some reason.

==1 worked for me as well.

However, the result isn't exactly what I was attempting to accomplish. What I'm looking to do is the following:

When a person without a custom title posts, I would like his postbit information to include a link that says "please click here to get your custom title."

The current suggested method displays that "please click here" message on the posts for *everybody* who lacks a custom title, that is, if Person A is logged in to the forums and lacks a custom title (and starts a thread), Person B replies and he lacks a custom title as well, both posts will read "please click here to get your custom title" to both person A and B. Is there any way for person A to see the message under only person A's post, and not everybody else who lacks a custom title as well?

Sorry for the incoherency of this post, I'm having a difficult time explaining myself. Also, once again, thank you VERY much for your time, help, and patience.

Logician
04-01-2003, 06:58 PM
Today at 10:08 PM lowtaxbaby said this in Post #184 (https://vborg.vbsupport.ru/showthread.php?postid=376464#post376464)
When a person without a custom title posts, I would like his postbit information to include a link that says "please click here to get your custom title."

ok try this one:

[[($post[customtitle]==0 AND $post[userid]==$bbuserinfo[userid])]]
please click here to get your custom title
[[/($post[customtitle]==0 AND $post[userid]==$bbuserinfo[userid])]]

lowtaxbaby
04-01-2003, 08:16 PM
Today at 08:58 PM Logician said this in Post #185 (https://vborg.vbsupport.ru/showthread.php?postid=376491#post376491)

ok try this one:

[[($post[customtitle]==0 AND $post[userid]==$bbuserinfo[userid])]]
please click here to get your custom title
[[/($post[customtitle]==0 AND $post[userid]==$bbuserinfo[userid])]]

That worked like a charm! Thank you very much for your hack and your support!

Boofo
04-11-2003, 12:42 AM
Sinan, how could I make it so it would show Subscribe to a user if they are NOT subscribed to a thread and show Unsubscribe if they ARE subscribed to a thread? I think it can be done but I'm not sure of the exact conditional to use. ;)

Logician
04-11-2003, 06:47 AM
Today at 04:36 AM Boofo said this in Post #187 (https://vborg.vbsupport.ru/showthread.php?postid=380416#post380416)
Sinan, how could I make it so it would show Subscribe to a user if they are NOT subscribed to a thread and show Unsubscribe if they ARE subscribed to a thread? I think it can be done but I'm not sure of the exact conditional to use. ;)
Actually you can't do it with conditionals. Because vb does not check if thread reader has a subscription to that thread. This is why we have a hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=35493) for this.. ;)

Please do not email or PM me for Logician's hacks. Post in the Requests Forum and he will help you as best I can.

lol Bob! What is that all about? Do you really get emails and PMs for my hacks? I didnt understand why people mail you.

Boofo
04-11-2003, 09:48 AM
What I am trying to do is have a Subscribe link (Next to the Moderated By link) that will change to Unsubscribe and Subscribe according to the user's subscription. This will be on the forum home and forumdisplay and it will be for forums.

lol Bob! What is that all about? Do you really get emails and PMs for my hacks? I didnt understand why people mail you.

That is my tribute to you, sir. No, nobody has ever written me about your hacks. Except maybe where to find them on here. I set that up to see how long it would take for anyone to notice that I wasn't talking about my own hacks. You're the first. If it bothers you, I can take it down. ;)

Logician
04-11-2003, 06:24 PM
Today at 01:42 PM Boofo said this in Post #189 (https://vborg.vbsupport.ru/showthread.php?postid=380512#post380512)
What I am trying to do is have a Subscribe link (Next to the Moderated By link) that will change to Unsubscribe and Subscribe according to the user's subscription. This will be on the forum home and forumdisplay and it will be for forums.

sorry not possible without hack because vb does not save your subscription status in a variable that you can use in a conditional. You need a hack for this and there is one for forum subscriptions too.


That is my tribute to you, sir. No, nobody has ever written me about your hacks. Except maybe where to find them on here. I set that up to see how long it would take for anyone to notice that I wasn't talking about my own hacks. You're the first. If it bothers you, I can take it down. ;)
lol thx.. no it does not bother me at all. I hope you'll get pms about your own hacks too but I dont know if you'll like it when you start to get a lot of pms about that so that I don't wish. :knockedout:

Boofo
04-11-2003, 06:29 PM
Today at 02:18 PM Logician said this in Post #190 (https://vborg.vbsupport.ru/showthread.php?postid=380692#post380692)
sorry not possible without hack because vb does not save your subscription status in a variable that you can use in a conditional. You need a hack for this and there is one for forum subscriptions too.

I tried to use the forum subscription hack that is out and it added an extra query for each forum on the forumhome. Is there a way to do it in one query for all forums or at least a few less queries?

lol thx.. no it does not bother me at all. I hope you'll get pms about your own hacks too but I dont know if you'll like it when you start to get a lot of pms about that so that I don't wish. :knockedout:

My hacks really aren't worth pm-ing anyone about. At least with yours, I might get a pm or two. ;)

Logician
04-11-2003, 06:41 PM
I tried to use the forum subscription hack that is out and it added an extra query for each forum on the forumhome. Is there a way to do it in one query for all forums or at least a few less queries?
No easy way unless you are ready to hack more and have a new field in user table where you save user's subscribed forumids there. Then it would be automatically availability to your without querying the DB.

Boofo
04-11-2003, 06:48 PM
Today at 02:35 PM Logician said this in Post #192 (https://vborg.vbsupport.ru/showthread.php?postid=380699#post380699)
No easy way unless you are ready to hack more and have a new field in user table where you save user's subscribed forumids there. Then it would be automatically availability to your without querying the DB.

That'll work. Would you help me with it, sir? ;)

irn-bru
04-21-2003, 01:30 PM
I wonder if this can be done.

[[($bbuserinfo[usergroupid]==2 $bbuserinfo[usergroupid]==3 OR
$bbuserinfo[usergroupid]==4 OR $bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

$forumbits

[[/($bbuserinfo[usergroupid]==2 $bbuserinfo[usergroupid]==3 OR
$bbuserinfo[usergroupid]==4 OR $bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]

In doing this I would like to show all members the $forumbits
and just visitors the rest of the forum home. I know I could just code the index.pho with.

if ($bbuserinfo[userid]==0) {
show_nopermission();
}

But I would like guest to see the shoutbox and whos online
and not just the nopermission please register template. Also
the show_nopermission I would like that to replace the $forumbits
for guests only.

Logician
04-21-2003, 02:52 PM
yeah seems applicable, why dont you give a shot?

irn-bru
04-21-2003, 02:54 PM
With a few changes it worked. :)

Just one more question can I do this.

[[($bbuserinfo[usergroupid]==1)]]

" I want to get a template from the database
and not put my html in here. How would I do that?"

[[/($bbuserinfo[usergroupid]==1)]]

Thanks for the help. I have attached my forumbits
html.

Logician
04-21-2003, 05:32 PM
Today at 05:54 PM irn-bru said this in Post #196 (https://vborg.vbsupport.ru/showthread.php?postid=385156#post385156)
" I want to get a template from the database
and not put my html in here. How would I do that?"

no way without hacking. ;)

CRego3D
05-12-2003, 02:16 AM
Let me ask you if this is possible

I have a custom profile entry "profilefieldid=5"

I want to have a different template based on what the user puts there, example

if the user puts: rabit or Rabit = template A / ckicken or Chicken = template b

(if they put something it's not defined, then shows nothing of course)

can it be ?

Logician
05-12-2003, 07:06 AM
[[(strtolower($bbuserinfo[field5])=='rabit')]]
Template A
[[/(strtolower($bbuserinfo[field5])=='rabit')]]
[[(strtolower($bbuserinfo[field5])=='chicken')]]
Template B
[[/(strtolower($bbuserinfo[field5])=='chicken')]]

CRego3D
05-13-2003, 04:44 AM
COOL :D

Slynderdale
05-13-2003, 09:38 AM
This hack lets you use conditions like on vbulletin 3.0.

examples:

<if($bbuserinfo[userid]==0)>stuff</if>
<if($bbuserinfo[userid]==0)>stuff<else />else stuff</if>

<if($bbuserinfo[usergroupid]==0)>
stuff
</if>

<if($bbuserinfo[usergroupid]==0)>
stuff
<else />
else stuff
</if>

And so on.

Also I want to note, that at the moment, you cant use conditions inside a condition. It will mess up. I'll try to come up with a fix till then.

If you like this hack and plan to use it, please click install.
Now im off to school, if any one exspirences any problems, I'll get back to you asap.

Hope you like it.

Slynderdale
05-13-2003, 09:40 AM
Also note that its <else /> not <else> or <else/>

Erwin
05-13-2003, 10:25 AM
Very cool. :)

Mephisteus
05-13-2003, 12:15 PM
very very nice :) Installed :)

wolfe
05-13-2003, 12:47 PM
d00d i can't find any of the code in the functions.php file :(

Slynderdale
05-13-2003, 12:51 PM
Today at 09:47 AM wolfe said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=394540#post394540)
d00d i can't find any of the code in the functions.php file :(


Find the gettemplates function and paste the first part of the code in it near the botton of it near the code that resembles the first part I told you to find.

Then under the function add the one I made and thats basicly it.

filburt1
05-13-2003, 01:45 PM
Is my mind completely shot or isn't this virtually identical to the other conditionals hack?

Logician
05-13-2003, 02:05 PM
threads merged..

Boofo
05-13-2003, 02:19 PM
Today at 05:38 AM Slynderdale said this in Post #201 (https://vborg.vbsupport.ru/showthread.php?postid=394496#post394496)
This hack lets you use conditions like on vbulletin 3.0.

examples:

<if($bbuserinfo[userid]==0)>stuff</if>
<if($bbuserinfo[userid]==0)>stuff<else />else stuff</if>

<if($bbuserinfo[usergroupid]==0)>
stuff
</if>

<if($bbuserinfo[usergroupid]==0)>
stuff
<else />
else stuff
</if>

And so on.

Also I want to note, that at the moment, you cant use conditions inside a condition. It will mess up. I'll try to come up with a fix till then.

If you like this hack and plan to use it, please click install.
Now im off to school, if any one exspirences any problems, I'll get back to you asap.

Hope you like it.

Can this be used along with Logician's conditional hack?

EvilLS1
05-14-2003, 05:48 AM
I can't believe I've overlooked this hack for so long! This is brilliant! Great hack Logician!

midnightz
05-17-2003, 09:35 PM
Awesome Hack,

Is there away to have it work with a gallery image link in postbit that only shows up if you have a Photopost gallery upload. Such as the way Vbjournal shows up in postbit when you have a journal and not there if you dont.?

This is a great hack, I don't know if I can do the above easier with a fewlines of code or with the hack. But I'm alreday playing with this yummy hack...

Many Cheers and Whooo Hooos,

midnightz

Logician
05-19-2003, 03:49 PM
Is there away to have it work with a gallery image link in postbit that only shows up if you have a Photopost gallery upload.
It can not be done with templates because vb code can not know if a user has a gallery or not without querying the database (= hacking). :) You have to use a hack first so that vb code knows it while running. Then conditionals can depend on this info.

|oR|Greg
05-20-2003, 05:54 PM
Great hack btw, I added it to vBHL on my site to control the main page visitors see, registered/logged in users see it differently with more options, layout.

NexDog
05-28-2003, 03:10 AM
I have a sidebar on index and in it I want to display a table for registered users and a different table for guests. I guess I can use this for registered users:

[[($bbuserinfo[userid])]] TEXT GOES HERE [[/($bbuserinfo[userid])]]

But what is the variable used for guests?

Boofo
05-28-2003, 03:42 AM
For registered users use:

[[($bbuserinfo[userid]!=0)]] TEXT GOES HERE [[/($bbuserinfo[userid]!=0)]]

and for guests use:

[[($bbuserinfo[userid]==0)]] TEXT GOES HERE [[/($bbuserinfo[userid]==0)]]

Logician
05-28-2003, 07:03 AM
as Bob said.

NexDog
05-29-2003, 03:41 AM
Thanks guys, you most definitely rock. :)

Now if I can just get stats to parse in the header template.....

NexDog
05-30-2003, 10:08 PM
Will this work with html code as well as text. For example:

[[($bbuserinfo[userid]==0)]] HTML CODE HERE [[/($bbuserinfo[userid]==0)]]

Slynderdale
05-30-2003, 10:34 PM
Today at 07:08 PM NexDog said this in Post #218 (https://vborg.vbsupport.ru/showthread.php?postid=402137#post402137)
Will this work with html code as well as text. For example:

[[($bbuserinfo[userid]==0)]] HTML CODE HERE [[/($bbuserinfo[userid]==0)]]


Yes, html will work there as well

Boofo
05-30-2003, 11:03 PM
Like Slynderdale said.

NexDog
06-01-2003, 02:44 PM
I love this hack! I have it working exactly as I want it. Thanks to all for your help and patience as always. :)

* NexDog installs

sonic3d
06-21-2003, 10:49 PM
how do i make it so in some1's profile a piece of code does not show up for that user. which means no1 can view it.

l8er
sonic

sonic3d
06-24-2003, 06:04 PM
ne1?

scri
06-27-2003, 02:32 PM
i was wondering if anyone knew what the condition was to allow images in sigs in a particular forum?

Logician
06-27-2003, 06:15 PM
Today at 06:32 PM scri said this in Post #224 (https://vborg.vbsupport.ru/showthread.php?postid=413381#post413381)
i was wondering if anyone knew what the condition was to allow images in sigs in a particular forum?
This can't be done with template conditionals..

allfather
07-13-2003, 07:41 PM
i read a few pages (not understanding exactly how) but i couldnt see anyone who had forced "themes" for different usergroups.

could anyone explain how to me pritty please?
(the hack itself was simple anough to install,just silly me who thought i could just go into admin section now and choose different themes for usergroups :p )

allfather
07-13-2003, 07:52 PM
[[(2==6)]]
Advanced Templates Hack has been successfully installed! By the way this remark is visible to Site Admins only.. ;) Enjoy..
Logician \\=^))

[[/(2==6)]]

^^^^ i still get that thoght eventhough i opened up mozilla and used a test account with normal acceess :(

Logician
07-13-2003, 08:58 PM
Yesterday at 11:52 PM allfather said this in Post #227 (https://vborg.vbsupport.ru/showthread.php?postid=417513#post417513)
[[(2==6)]]
Advanced Templates Hack has been successfully installed! By the way this remark is visible to Site Admins only.. ;) Enjoy..
Logician \\=^))

[[/(2==6)]]

^^^^ i still get that thoght eventhough i opened up mozilla and used a test account with normal acceess :(
I dont think you installed the hack correctly.

1- Make sure you applied instructions correctly
2- Make sure you uploaded functions.php to your server.
3- Make sure you uploaded functions.php to the correct directory.

Either one is your problem..

allfather
07-13-2003, 09:51 PM
yes i i accidentaly deleted a line :)
but can you help me with the usergroup and forced STYLE thing?

regards

thomas


(ps,exelent hack:) )

Logician
07-13-2003, 10:40 PM
I don't understand what you mean by "theme"?!?

allfather
07-13-2003, 10:54 PM
style then ffs :p

Logician
07-13-2003, 11:04 PM
this hack can not help you to change style according to usergroup. Try searching in hack requests forum with keywords "$styleid*" "$style*". You can find a solution there.

allfather
07-13-2003, 11:09 PM
bollox, i got told this was what i needed for that :(

sweet22
08-18-2003, 04:47 AM
how do you know user group ids?

Dolby
08-25-2003, 08:22 PM
08-18-03 at 12:47 AM sweet22 said this in Post #234 (https://vborg.vbsupport.ru/showthread.php?postid=426758#post426758)
how do you know user group ids?

Go to the Admin Control Panel and go to User Groups menu heading and click [Manage]. Hover your mouse over the [edit] link for each usergroup and you will find the group id in the URL.

The standard group ID's are:

Unregistered / Not Logged In = 1
Registered = 2
Users Awaiting Email Confirmation = 3
(COPPA) Users Awaiting Moderation = 4
Super Moderators = 5
Administrators = 6
Moderators = 7
Banned by Moderators = (custom to forum must look up your self)

99SIVTEC
08-26-2003, 10:17 PM
I've got a forum that is a network of sites using vbulletin and phpportals. I would like the header to change depending on which sub forum you are in. This would allow me to have a unique look for each "club". Is this possible with this hack?

Logician
08-27-2003, 06:51 AM
Today at 02:17 AM 99SIVTEC said this in Post #236 (https://vborg.vbsupport.ru/showthread.php?postid=428855#post428855)
I've got a forum that is a network of sites using vbulletin and phpportals. I would like the header to change depending on which sub forum you are in. This would allow me to have a unique look for each "club". Is this possible with this hack?
I would say use an external hack for your request. I guess it is already provided in hacks requests forum. Check with keyword "$header" or "forumdisplay.php". Also check in this forum as a hack might already exist.

ImportPassion
08-29-2003, 06:55 PM
how can i use this to only show something if the user is Online?
I have tried several things, none have worked.

THanks,
Derek

memobug
08-29-2003, 08:44 PM
Who is the user are you talking about? The one looking at the forum or the one whose user information might appear in the context of one of the other other templates?

There is an $onlinestatus in the postbit template. If you mean the person looking at the pages, that's different.

Maybe you could suggest what you are trying to do for more help.

Regards,

Matt

ImportPassion
08-29-2003, 11:43 PM
ya, i should have explained it better.

I want to use it for any user in the postbit. I tried using the $onlinestatus=='Online' and it doesn't work. I tried several variations of it in fact.
I want to show a graphic if the user is in x usergroup and currently online.

Derek

Logician
08-30-2003, 07:37 AM
Today at 03:43 AM 7thgenCivic.Com said this in Post #240 (https://vborg.vbsupport.ru/showthread.php?postid=429591#post429591)
ya, i should have explained it better.

I want to use it for any user in the postbit. I tried using the $onlinestatus=='Online' and it doesn't work. I tried several variations of it in fact.
I want to show a graphic if the user is in x usergroup and currently online.

Derek

[[($post[userid]!=0 AND $post[lastactivity] > $datecut and !$post[invisible] and $post[lastvisit] != $post[lastactivity])]]
Your code
[[/($post[userid]!=0 AND $post[lastactivity] > $datecut and !$post[invisible] and $post[lastvisit] != $post[lastactivity])]]

This may work. If it does not, it means your request can not be done via this hack.

scudly
09-11-2003, 05:32 PM
Ok I've got a slight problem, I've got the hack installed perfectly and all is well. But what I wanted to use it for was to restrict access to a specific forum based on user-group, [ie, only supermods and above] only I can't do that via any template can I or am I not looking in the right place?

Logician
09-11-2003, 05:44 PM
why don't you do it with default usergroup/forum permissions?

Pollo
10-08-2003, 06:02 PM
I've got an odd issue... (and hope to goodness someone didn't post it before). Conditionals work.. sometimes.

In header template, this does NOT work:
[[($foruminfo[forumid]==44)]] Display this HTML code if forum id is 44 [[/($foruminfo[forumid]==44)]]

-but this DOES:
[[($bbuserinfo[userid]==1)]] Display this HTML code if page visitor's user id is 1 [[/($bbuserinfo[userid]==1)]]

I know it used to work at the time. Since installing this hack, I've installed:
Easy Archive Final
Forum Quick Stats
A 'Contact Us' form hack
Subforums on Forumhome (no queries) by Xenon.

The last one may be tripping this up, it's the only thing I can think of that may be conflicting.

I'd reinstall this hack, but it *is* working, for some things. Any ideas?

Logician
10-08-2003, 07:51 PM
I've got an odd issue... (and hope to goodness someone didn't post it before). Conditionals work.. sometimes.

In header template, this does NOT work:
[[($foruminfo[forumid]==44)]] Display this HTML code if forum id is 44 [[/($foruminfo[forumid]==44)]]

Not related to the hack, it is a technical restriction.

Your problem is: the header template is formed by vbulletin before "$foruminfo[forumid]" variable gets a value so when you use such a variable in your header, it will be always equal to 0, regardless of your location in board.

That conditional will only work in forumdisplay templates as $foruminfo[forumid] variable will be assigned a value when these templates are parsed. It should also work if you use "$forumid" variable in your header because apparently it is assigned a value before header template is parsed but I didn't test it.

Pollo
10-08-2003, 08:06 PM
Logician, thank you very much for the reply. I *may* have been mistaken in regards to it working before (according to what you wrote), or at least the syntax of the code. I had a custom header hack installed along with yours which was broken by the subforums on forumhome hack (custom header hack was removed as it didn't work and I didn't think it was needed in addition to your hack). It is likely I used that to display the custom code.

I changed my coding to:

[[($forumid==24)]] Show this only on forum 24 [[/($forumid==24)]]

-and it worked fine in the header template. It's a great hack, and again, thank you for helping.

squawell
10-15-2003, 12:49 AM
hello Logocian,i need some help...

see the link first

https://vborg.vbsupport.ru/showthread.php?p=440602#post440602

how should i use this hack to do that?

what code should i use and which template should i place it

to?thankz...:)

Pollo
10-16-2003, 08:11 AM
Confused once again... sad really.

In the postbit, the signature: $post[signature]

What I'd like to do is remove the signature for two users. One userID being 1669 and the other being 1472. I don't care if they see their own signature, but I do not want any other user on the board to see it, including admins, mods, etc. So for them, they'll think it's still there (just so they won't bug me), but for everyone else, it won't exist.

I've tried this a bunch of ways, can't get it to work, and I know it's simple and as soon as someone posts it, I'll be smacking myself on the head. Any help would be appreciated, and I (again) hope this hasn't been asked before in this thread. I've read this entire thread before, but can't recall if it is in here.

Logician
10-16-2003, 10:18 AM
[[(($post[userid]!=1669 AND $post[userid]!=1472) OR ($bbuserinfo[userid]!=1669 AND $bbuserinfo[userid]!=1472))]]
$post[signature]
[[/(($post[userid]!=1669 AND $post[userid]!=1472) OR ($bbuserinfo[userid]!=1669 AND $bbuserinfo[userid]!=1472))]]

Not tested but seems ok.. give it a shot..

Pollo
10-16-2003, 08:01 PM
It didn't work :( I do appreciate the try though.