vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=319644

Plugin using global_complete hook, cant exclude from a forum using if conditional
by basketmen
28 Jul 2015 02:33

This is replacement code from kh99, using global_complete hook, its works good


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.





but now i want to exclude a forum
already tried wrap it using below if conditional, but its not works

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

what is the right if conditional? or this cant be done because its using global_complete hook? :confused:
please help guys

MarkFL 28 Jul 2015 03:12

Try the hook location "forum_display_start" and the plugin PHP code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


basketmen 28 Jul 2015 05:49

its not only for forumdisplay, but for showthread too

it is better using forum_display_start hook or global_complete?

MarkFL 28 Jul 2015 06:23

You have a "Post New Thread" button on your "showthread" pages?

basketmen 28 Jul 2015 06:32

Quote:

Originally Posted by MarkFL (Post 2551543)
You have a "Post New Thread" button on your "showthread" pages?

its just example text, i use for some text

MarkFL 28 Jul 2015 07:52

Ah okay, your initial post led me to believe you were trying to change the text that displays in the "Post New Thread" button. :)

basketmen 28 Jul 2015 08:36

Quote:

Originally Posted by MarkFL (Post 2551547)
Ah okay, your initial post led me to believe you were trying to change the text that displays in the "Post New Thread" button. :)

thank you for the alternative way using forum_display_start hook


so what is the right if conditional to exclude a forum with global_complete hook?

MarkFL 28 Jul 2015 09:08

The forumid data does not appear to be available at that hook.

Easy5s.net 28 Jul 2015 12:03

try $GLOBAL['forumid']

basketmen 28 Jul 2015 15:17

Quote:

Originally Posted by Easy5s.net (Post 2551564)
try $GLOBAL['forumid']

thank you for reply, tried this


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

but looks like not working, still same like not using it
any other code?



Quote:

Originally Posted by MarkFL (Post 2551554)
The forumid data does not appear to be available at that hook.

hmm if its true, the only way is using forum_display_start hook and one more plugin for shothread_start

kh99 28 Jul 2015 17:56

global_complete is one of the last things called. I think what you want is something like global_setup_complete.

I was looking at code a little, and while I'm sure in th past I've suggested that people use $forumid or $GLOBALS['forumid'] (it has an 'S' at the end), it looks like that's a bad one to use unless you're using a hook that's only called on forum.php. It looks like most of the time, $foruminfo['forumid'] is what you'd want (unless you know you're interested in $threadinfo or $post).

basketmen 29 Jul 2015 01:51

Quote:

Originally Posted by kh99 (Post 2551590)
global_complete is one of the last things called. I think what you want is something like global_setup_complete.

I was looking at code a little, and while I'm sure in th past I've suggested that people use $forumid or $GLOBALS['forumid'] (it has an 'S' at the end), it looks like that's a bad one to use unless you're using a hook that's only called on forum.php. It looks like most of the time, $foruminfo['forumid'] is what you'd want (unless you know you're interested in $threadinfo or $post).

$GLOBALS['forumid'] with global_complete hook is works

global_setup_complete hook not works


thank you kh99, MarkFL & Easy5s.net

kh99 29 Jul 2015 10:06

Quote:

Originally Posted by basketmen (Post 2551615)
$GLOBALS['forumid'] with global_complete hook is works

global_setup_complete hook not works


thank you kh99, MarkFL & Easy5s.net

Oh, right, I see now that you're doing str_replace() on $output. That would have to be done at the end using global_complete. I'm still kind of surprised that $GLOBALS['forumid'] works, but I can't argue with success.


All times are GMT. The time now is 02:50.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.