PDA

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


Pages : [1] 2

Logician
08 Sep 2002, 18:19
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 (http://www.vbulletin.org/forum/showthread.php?s=&threadid=36419) and Dynamic Forum Announcements Hack (http://www.vbulletin.org/forum/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 (http://www.vbulletin.org/forum/showthread.php?s=&threadid=36419) hack since March 2002 so in fact vb developers might be inspired by me. ;) My Dynamic Forum Announcements hack (http://www.vbulletin.org/forum/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 (http://www.vbulletin.org/forum/showthread.php?s=&threadid=36419) which provides exactly the same feature for your NON-VB pages.

Also please click INSTALL (http://www.vbulletin.org/forum/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
08 Sep 2002, 18:19
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
08 Sep 2002, 18:20
Conditionals Help

If you are using my WebTemplates Hack (http://www.vbulletin.org/forum/showthread.php?s=&threadid=36419) or Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals Hack (http://www.vbulletin.org/forum/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
08 Sep 2002, 18:20
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
08 Sep 2002, 18:22
Very cool:)

*installs*

Satan

assassingod
08 Sep 2002, 18:28
Aww man, this is Ace! Brilliant work! Gonna instal this!!:)

Tim Wheatley
08 Sep 2002, 18:52
Fantastic, absolutely bloody fantastic. :)

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

Chris M
08 Sep 2002, 19:41
Did you make sure you did the modifications to :

admin/functions.php

Satan

Logician
08 Sep 2002, 20:39
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
08 Sep 2002, 20:51
this is just too good to be true :D

awesome hack mate

- Mist

Neo
09 Sep 2002, 02:57
In one sentence what does this do?

Austin Dea
09 Sep 2002, 03:25
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 Sep 2002, 06:17
Another brilliant hack by Logician
Well done and thankyou
:D

Logician
09 Sep 2002, 06:54
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 Sep 2002, 21:23
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
10 Sep 2002, 00:10
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
10 Sep 2002, 00:50
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 (http://www.vbulletin.org/forum/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 :) :
http://www.vbulletin.org/forum/showthread.php?s=&threadid=16743&highlight=conditionals

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

Logician
10 Sep 2002, 08:05
Originally posted by fastforward

Great hack Logician, but Ed was inspired way before March 2002 :) :
http://www.vbulletin.org/forum/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
10 Sep 2002, 08:27
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
10 Sep 2002, 09:19
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
10 Sep 2002, 09:29
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
10 Sep 2002, 19:41
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
10 Sep 2002, 21:07
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
10 Sep 2002, 21:10
Wow! I can't wait to try this out!

/me clicks install button

AndrewD
11 Sep 2002, 06:58
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
13 Sep 2002, 00:28
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
13 Sep 2002, 09:11
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
16 Sep 2002, 09:27
hi

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

thanks

Logician
16 Sep 2002, 12:09
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
17 Sep 2002, 18:35
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
17 Sep 2002, 19:13
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
17 Sep 2002, 19:18
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
21 Sep 2002, 16:30
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
21 Sep 2002, 16:43
Originally posted by fastforward

Great hack Logician, but Ed was inspired way before March 2002 :) :
http://www.vbulletin.org/forum/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
21 Sep 2002, 21:49
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
21 Sep 2002, 22:02
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
22 Sep 2002, 11:16
perhaps you've read that already, but if not:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=55163&pagenumber=2

Logician
22 Sep 2002, 16:01
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
22 Sep 2002, 23:51
what is this like on server load? it seems to be pretty hard on my site. any ideas?

Logician
23 Sep 2002, 09:27
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
23 Sep 2002, 14:23
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
02 Oct 2002, 17:19
Does anyone know if this adds any additional DB queries?

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

Please check 2 posts above..

BlueVoltage
04 Oct 2002, 17:42
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
04 Oct 2002, 17:42
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
04 Oct 2002, 18:36
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
04 Oct 2002, 23:17
i got it now. sorry. GREAT HACK!!!

mikey8270
05 Oct 2002, 00:07
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
05 Oct 2002, 03:32
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
05 Oct 2002, 08:25
@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
05 Oct 2002, 12:26
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
05 Oct 2002, 13:19
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
07 Oct 2002, 10:26
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
07 Oct 2002, 10:39
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
07 Oct 2002, 19:06
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
07 Oct 2002, 19:22
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
08 Oct 2002, 01:15
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
08 Oct 2002, 11:15
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
08 Oct 2002, 12:42
great
***install***

Wildthinks
09 Oct 2002, 09:19
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
13 Oct 2002, 03:59
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
13 Oct 2002, 09:43
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
14 Oct 2002, 19:20
whats the conditional for forumid?

Regards

- miSt

Logician
15 Oct 2002, 10:53
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
15 Oct 2002, 16:39
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
16 Oct 2002, 10:17
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
16 Oct 2002, 16:44
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
17 Oct 2002, 12:55
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
17 Oct 2002, 18:31
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
17 Oct 2002, 19:03
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
18 Oct 2002, 18:24
lol why didn't i think of the " != "

Thanks buddy

- miSt

HappyPike
18 Oct 2002, 20:50
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
18 Oct 2002, 21:03
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
19 Oct 2002, 19:19
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
27 Oct 2002, 20:18
Can i use a condition of the ip of the user? Is there a var that in it is the user-ip?

NTLDR
27 Oct 2002, 20:45
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
27 Oct 2002, 23:19
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
29 Oct 2002, 03:49
Excellent Hack! Now even I can feel like a power user!!

JakeC

Bandit
02 Nov 2002, 03:05
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
02 Nov 2002, 08:21
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
16 Nov 2002, 20:40
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
16 Nov 2002, 21:26
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
16 Nov 2002, 21:39
Oh man, that's sweet :)
Thanks! Again, great hack.

N9ne
23 Nov 2002, 11:42
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
25 Nov 2002, 19:09
Question: Can the ismoderator function somehow be used?

Logician
26 Nov 2002, 12:50
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
01 Dec 2002, 17:36
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
02 Dec 2002, 10:38
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
08 Dec 2002, 22:34
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
08 Dec 2002, 23:59
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
22 Dec 2002, 06:09
Would there be a way to use this to make a forum appear in a different style for different users? :)

Logician
22 Dec 2002, 20:18
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
25 Dec 2002, 15:00
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
26 Dec 2002, 09:25
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
26 Dec 2002, 10:35
noce hack

Boofo
26 Dec 2002, 11:01
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="http://www.vbulletin.org/forum/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="http://www.vbulletin.org/forum/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
30 Dec 2002, 20:30
Thank you Logician :)

Martin CX
02 Jan 2003, 23:11
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
06 Jan 2003, 09:16
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
21 Jan 2003, 16:26
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
21 Jan 2003, 17:28
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
21 Jan 2003, 22:10
the top_stats button links to vbstats.php
Its a hack i got off these forums. my website is www.ar-racing.com

Mike11212
21 Jan 2003, 22:38
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
21 Jan 2003, 22:48
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
21 Jan 2003, 22:53
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
21 Jan 2003, 23:12
thank you very very much :)

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

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

Mike11212
21 Jan 2003, 23:24
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
21 Jan 2003, 23:27
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
21 Jan 2003, 23:44
I want to hide it from every group except 19

JakeC
22 Jan 2003, 01:57
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
22 Jan 2003, 03:12
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
22 Jan 2003, 03:16
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
23 Jan 2003, 21:41
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
24 Jan 2003, 01:23
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
24 Jan 2003, 07:12
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
24 Jan 2003, 15:58
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
24 Jan 2003, 16:07
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
24 Jan 2003, 16:25
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
26 Jan 2003, 02:44
This is a wonderful hack. Thanks Logician ;)

Logik
27 Jan 2003, 22:33
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
28 Jan 2003, 08:20
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
28 Jan 2003, 11:31
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
28 Jan 2003, 16:23
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
29 Jan 2003, 00:09
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
29 Jan 2003, 00:12
What version were you running where you had problems? I am running 2.2.9 and it works fine.

Logik
29 Jan 2003, 00:13
It should work for all versions. Works for my 2.2.9.. :)

Boofo
29 Jan 2003, 00:19
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
29 Jan 2003, 09:31
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
12 Feb 2003, 16:30
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
12 Feb 2003, 20:08
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
13 Feb 2003, 22:20
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
13 Feb 2003, 22:21
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,thread.forumid,thread.rep\lycount,t hread.postusername,thread.postuserid,
thread.lastposter,thread.dateline,thread.views,post.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
13 Feb 2003, 23:20
If your looking for a similar hack like this but works in posts as a vB Code, try here:

http://www.vbulletin.org/forum/showthread.php?s=&threadid=48492

Edgemyster
18 Feb 2003, 21:29
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
18 Feb 2003, 21:42
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
19 Feb 2003, 03:15
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
19 Feb 2003, 06:53
try to reapply.. a recent hack might have overwrited the hack somehow..

bensonfactor
21 Feb 2003, 19:19
It was because I was putting the first part after not before the code.

Works now. Thanks.

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

l8er
sonic

Boofo
27 Feb 2003, 01:06
I use it there for all sorts of things. ;)

Logician
27 Feb 2003, 08:01
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
01 Mar 2003, 15:01
This is the best hack ive installed for a long time!!!

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

Gutspiller
16 Mar 2003, 00:32
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
16 Mar 2003, 01:56
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
16 Mar 2003, 04:35
Yesterday at 09:56 PM JakeC said this in Post #147 (http://www.vbulletin.org/forum/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
16 Mar 2003, 08:35
Today at 03:32 AM Gutspiller said this in Post #146 (http://www.vbulletin.org/forum/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
16 Mar 2003, 09:13
Today at 04:35 AM Logician said this in Post #149 (http://www.vbulletin.org/forum/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
16 Mar 2003, 13:37
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
16 Mar 2003, 17:01
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
16 Mar 2003, 19:24
*Bump*

Today at 02:01 AM Matthew Lam said this in Post #152 (http://www.vbulletin.org/forum/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
17 Mar 2003, 07:16
Yesterday at 08:01 PM Matthew Lam said this in Post #152 (http://www.vbulletin.org/forum/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.
http://www.vbulletin.org/forum/showthread.php?postid=306036#post306036

Boofo
18 Mar 2003, 13:10
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
18 Mar 2003, 19:18
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
18 Mar 2003, 23:17
Words cannot express the absolute amazement that I have in this extremely awesome hack. Congratulations, Logician - this is absolutely brilliant.

Kaelon

Boofo
18 Mar 2003, 23:19
Logician is a magician. ;)

Mr. Brian
19 Mar 2003, 01:38
Ya, I did replaced instead of add.

03-17-03 at 04:24 AM Matthew Lam said this in Post #153 (http://www.vbulletin.org/forum/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
19 Mar 2003, 07:05
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 (http://www.vbulletin.org/forum/showthread.php?s=&threadid=39142)

Kars10
20 Mar 2003, 20:47
@ 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
21 Mar 2003, 09:45
Yesterday at 11:47 PM Kars10 said this in Post #161 (http://www.vbulletin.org/forum/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
21 Mar 2003, 09:53
@ 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
21 Mar 2003, 09:57
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
21 Mar 2003, 10:56
Today at 12:57 PM Boofo said this in Post #164 (http://www.vbulletin.org/forum/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
21 Mar 2003, 11:09
Thanks Logician!!
I have PMīt Boofo about that!!

Kars :)

Boofo
21 Mar 2003, 11:10
Today at 05:56 AM Logician said this in Post #165 (http://www.vbulletin.org/forum/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
22 Mar 2003, 18:12
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 (http://www.vbulletin.org/forum/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 (http://www.vbulletin.org/forum/showthread.php?s=&threadid=39142)

Thats exactly what I did. :(

Logician
22 Mar 2003, 18:30
Today at 09:12 PM Matthew Lam said this in Post #168 (http://www.vbulletin.org/forum/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
23 Mar 2003, 15:21
Ya, last time I used to use notepad. But I've already no longer using notepad but using editplus instead. :bored:

Mr. Brian
23 Mar 2003, 20:17
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
23 Mar 2003, 23:20
Yesterday at 11:17 PM Matthew Lam said this in Post #171 (http://www.vbulletin.org/forum/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
30 Mar 2003, 19:56
:banana: I can only dream of being so creative..
Outstanding hack.
Thank You :banana: :banana:

lowtaxbaby
01 Apr 2003, 14:11
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
01 Apr 2003, 14:16
Try this:

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

Logician
01 Apr 2003, 14:17
Today at 05:11 PM lowtaxbaby said this in Post #174 (http://www.vbulletin.org/forum/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
01 Apr 2003, 14:18
you are fast Bob! (and invisible) hehe

Boofo
01 Apr 2003, 14:23
Today at 09:18 AM Logician said this in Post #177 (http://www.vbulletin.org/forum/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
01 Apr 2003, 14:33
Today at 03:16 PM Boofo said this in Post #175 (http://www.vbulletin.org/forum/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
01 Apr 2003, 17:13
Today at 05:33 PM lowtaxbaby said this in Post #179 (http://www.vbulletin.org/forum/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
01 Apr 2003, 17:27
How would that custom title condition work in the getinfo template (profile)?

Logician
01 Apr 2003, 18:04
$userinfo[customtitle] $userinfo[usertitle]

Boofo
01 Apr 2003, 18:06
Thank you. sir. ;)

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

lowtaxbaby
01 Apr 2003, 19:08
Today at 07:06 PM Boofo said this in Post #183 (http://www.vbulletin.org/forum/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
01 Apr 2003, 19:58
Today at 10:08 PM lowtaxbaby said this in Post #184 (http://www.vbulletin.org/forum/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
01 Apr 2003, 21:16
Today at 08:58 PM Logician said this in Post #185 (http://www.vbulletin.org/forum/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
11 Apr 2003, 01:42
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
11 Apr 2003, 07:47
Today at 04:36 AM Boofo said this in Post #187 (http://www.vbulletin.org/forum/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 (http://www.vbulletin.org/forum/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
11 Apr 2003, 10:48
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
11 Apr 2003, 19:24
Today at 01:42 PM Boofo said this in Post #189 (http://www.vbulletin.org/forum/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
11 Apr 2003, 19:29
Today at 02:18 PM Logician said this in Post #190 (http://www.vbulletin.org/forum/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
11 Apr 2003, 19:41
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
11 Apr 2003, 19:48
Today at 02:35 PM Logician said this in Post #192 (http://www.vbulletin.org/forum/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
21 Apr 2003, 14:30
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
21 Apr 2003, 15:52
yeah seems applicable, why dont you give a shot?

irn-bru
21 Apr 2003, 15:54
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
21 Apr 2003, 18:32
Today at 05:54 PM irn-bru said this in Post #196 (http://www.vbulletin.org/forum/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
12 May 2003, 03:16
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
12 May 2003, 08:06
[[(strtolower($bbuserinfo[field5])=='rabit')]]
Template A
[[/(strtolower($bbuserinfo[field5])=='rabit')]]
[[(strtolower($bbuserinfo[field5])=='chicken')]]
Template B
[[/(strtolower($bbuserinfo[field5])=='chicken')]]

CRego3D
13 May 2003, 05:44
COOL :D

Slynderdale
13 May 2003, 10:38
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
13 May 2003, 10:40
Also note that its <else /> not <else> or <else/>

Erwin
13 May 2003, 11:25
Very cool. :)

Mephisteus
13 May 2003, 13:15
very very nice :) Installed :)

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

Slynderdale
13 May 2003, 13:51
Today at 09:47 AM wolfe said this in Post #5 (http://www.vbulletin.org/forum/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
13 May 2003, 14:45
Is my mind completely shot or isn't this virtually identical to the other conditionals hack?

Logician
13 May 2003, 15:05
threads merged..

Boofo
13 May 2003, 15:19
Today at 05:38 AM Slynderdale said this in Post #201 (http://www.vbulletin.org/forum/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
14 May 2003, 06:48
I can't believe I've overlooked this hack for so long! This is brilliant! Great hack Logician!

midnightz
17 May 2003, 22:35
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
19 May 2003, 16:49
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
20 May 2003, 18:54
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
28 May 2003, 04:10
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
28 May 2003, 04:42
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
28 May 2003, 08:03
as Bob said.

NexDog
29 May 2003, 04:41
Thanks guys, you most definitely rock. :)

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

NexDog
30 May 2003, 23:08
Will this work with html code as well as text. For example:

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

Slynderdale
30 May 2003, 23:34
Today at 07:08 PM NexDog said this in Post #218 (http://www.vbulletin.org/forum/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
31 May 2003, 00:03
Like Slynderdale said.

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

/me installs

sonic3d
21 Jun 2003, 23:49
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
24 Jun 2003, 19:04
ne1?

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

Logician
27 Jun 2003, 19:15
Today at 06:32 PM scri said this in Post #224 (http://www.vbulletin.org/forum/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
13 Jul 2003, 20:41
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
13 Jul 2003, 20:52
[[(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
13 Jul 2003, 21:58
Yesterday at 11:52 PM allfather said this in Post #227 (http://www.vbulletin.org/forum/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
13 Jul 2003, 22:51
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
13 Jul 2003, 23:40
I don't understand what you mean by "theme"?!?

allfather
13 Jul 2003, 23:54
style then ffs :p

Logician
14 Jul 2003, 00:04
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
14 Jul 2003, 00:09
bollox, i got told this was what i needed for that :(

sweet22
18 Aug 2003, 05:47
how do you know user group ids?

Dolby
25 Aug 2003, 21:22
08-18-03 at 12:47 AM sweet22 said this in Post #234 (http://www.vbulletin.org/forum/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
26 Aug 2003, 23:17
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
27 Aug 2003, 07:51
Today at 02:17 AM 99SIVTEC said this in Post #236 (http://www.vbulletin.org/forum/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
29 Aug 2003, 19:55
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
29 Aug 2003, 21:44
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
30 Aug 2003, 00:43
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
30 Aug 2003, 08:37
Today at 03:43 AM 7thgenCivic.Com said this in Post #240 (http://www.vbulletin.org/forum/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
11 Sep 2003, 18:32
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
11 Sep 2003, 18:44
why don't you do it with default usergroup/forum permissions?

Pollo
08 Oct 2003, 19:02
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
08 Oct 2003, 20:51
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
08 Oct 2003, 21:06
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
15 Oct 2003, 01:49
hello Logocian,i need some help...

see the link first

http://www.vbulletin.org/forum/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
16 Oct 2003, 09:11
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
16 Oct 2003, 11:18
[[(($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
16 Oct 2003, 21:01
It didn't work :( I do appreciate the try though.