vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   exclude groups from no-cache http headers ? (https://vborg.vbsupport.ru/showthread.php?t=328155)

X-or 07-26-2020 03:23 PM

exclude groups from no-cache http headers ?
 
there is a vb option which causes me a lot of problems
Add No-Cache HTTP Headers (default No)

the above option saves a lot of queries but also cause problems to users who constantly have to refresh pages manually

can't we have something in between and excludes groups like unregistered from these No-Cache headers?

z3r0 07-27-2020 04:46 PM

I've not got any time to do any testing, but couldn't you just turn the no-cache option on and off per usergroup in a plugin?

So to disable for guests:-
hook location - global start
Code:

if ($vbulletin->userinfo['userid'] == 0) {
$vbulletin->options['nocacheheaders'] = 0;
}


X-or 07-29-2020 05:30 AM

Quote:

Originally Posted by z3r0 (Post 2603610)
I've not got any time to do any testing, but couldn't you just turn the no-cache option on and off per usergroup in a plugin?

So to disable for guests:-
hook location - global start
Code:

if ($vbulletin->userinfo['userid'] == 0) {
$vbulletin->options['nocacheheaders'] = 0;
}


Thanks for your help.

How can I test if it works though?

And is there a way to expand to multiple usergroups (to disable nocache for low activity groups as well), I know the syntax in templates, but plugins appear to use a different syntax.

z3r0 07-29-2020 06:22 AM

Just examine the headers sent by the page.

I always need to lookup the plugin syntax, after a quick search it looks like this is what you need for multiple groups.

Code:

if (is_member_of($vbulletin->userinfo, x,y))

X-or 07-29-2020 11:15 AM

Quote:

Originally Posted by z3r0 (Post 2603627)
Just examine the headers sent by the page.

Sorry if this sounds stupid but I don't know anything about that, what should I look for that would prove the page is cached or not cached.

Quote:

Originally Posted by z3r0 (Post 2603627)
I always need to lookup the plugin syntax, after a quick search it looks like this is what you need for multiple groups.

Code:

if (is_member_of($vbulletin->userinfo, x,y))

Thank, I will give it a try as soon as I know how to verify if it works.

z3r0 07-30-2020 04:09 AM

Most browsers have developer tools in their menu's, open the developer tools and check the element headers on the network tab (there is loads of info on google on how to do it)

I've had a quick look this morning and the code from my first post does seem to work, the pragma header switches between no-cache and private the same as it does when changing the global no-cache setting.

X-or 07-31-2020 08:21 AM

Thanks z3r0, so far it seems to work wonders.
I highly recommend this plugin to anyone who had to enable no-cache headers. This will keep cache enabled for inactive users without disturbing active members. A must have.


All times are GMT. The time now is 11:03 PM.

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

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

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

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