The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Any way to turn off post cache when a particular bb code is used?
I have a BB Code that I modify the exact size of based off a custom user profile field.
I do this by using a hook on bbcode_parse_start, scanning the code for this bb code, and if found setting a custom height. However while this seemed to work I notice now that the size is usually set by the first person to view it and I guess it's cached. Subsequent viewers don't see it at their specified height but that of whomever viewed it first's height. This isn't an often used bb code so i figured disabling the post cache if this bb code was used wouldn't be a big deal. However I'm not seeing how to do this... the code in class_bbcode.php to test if it is cachable is: Code:
if ($this->options['cachable']) Would there be some other way of turning off the post cache for a specific post? |
#2
|
|||
|
|||
I'm not completely sure if I know what's going on in the code, or if I get what you're asking, but I think there's different kinds of caching going on. One is to cache results during the processing of a page so that work isn't repeated, like parsing the same signatures over and over in the a thread. Then there's the post cache that survives between user requests. So I think that 'cachable' field in class_bbcode might be for caching signatures during one page request but not between (different users') requests. (I know this doesn't really help you solve your problem).
|
#3
|
||||
|
||||
Basically I have a BB Code... in the replacement code there used to be a part that said height="400" in an HTML tag.
But some users with high resolution screens asked for it to be taller than 400 pixels... So I made a custom user profile field where each user can specify the height they want for this particular BB Code. In the BB Code replacement I changed it from height="400" to height="xxx" (for example) and then on the hook bbcode_parse_start I do a str_replace for "xxx" and swap in the value set by the user in their profile field. For the most part this works except sometimes it gets cached at a different user's value. In class_bbcode.php there are the following lines around line 440... Code:
// save the cached post if ($this->options['cachable']) { $this->cached['text'] = $text; $this->cached['has_images'] = $has_img_tag; } // do [img] tags if the item contains images if(($do_bbcode OR $do_imgcode) AND $has_img_tag) { $text = $this->handle_bbcode_img($text, $do_imgcode, $has_img_tag); } ($hook = vBulletinHook::fetch_hook('bbcode_parse_complete')) ? eval($hook) : false; return $text; My main question is how can I change the value of $this->options['cachable'] because simply setting it equal to zero or false doesn't appear to have any affect. Unless what you're telling me it might be working but it's cached somewhere else... |
#4
|
|||
|
|||
Yeah, I guess I was saying that I think the cachable variable in class_bbcode isn't what controls caching of posts across different user requests (like you're describing). But in retrospect I probably shouldn't have replied at all unless I had a better answer than that.
|
#5
|
||||
|
||||
Quote:
|
#6
|
|||
|
|||
How did you go here BirdOfPrey5 - I'm looking for something similar ...
|
#7
|
||||
|
||||
I never did figure it out really... instead of doing the replacements on bbcode_parse_start and bbcode_parse_complete_precache I instead did them on postbit_display_complete, newpost_preview, and newreply_form_reviewbit and I didn't run into the cache issues with these hooks.
The down side is that I needed 3 plugins instead of 2 and it won't work if I ever needed to use the bb code outside a post (say in a social group or signature) but I won't so it's not a big deal- otherwise I'd need even more plugins for those locations. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|