vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   [RESOLVED] php forumid array (https://vborg.vbsupport.ru/showthread.php?t=285836)

Kirk Fitzgerald 07-22-2012 03:00 PM

[RESOLVED] php forumid array
 
Hiya, I need some help please.

I am trying to set a condition so that if a forumid is not equal to 34 or 54.

I have tried this:
PHP Code:

if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (in_array($forumid != forum['forumid'], array(3454)))) { 

But that is not working, the code is not working in any forumid with that condition, I am terrible at coding and searching google didn't help.

Can anyone help me out here please.

Lynne 07-22-2012 04:38 PM

Where are you putting that condition - what hook location? did you look up the hook and verify you are using the correct variable names?

Kirk Fitzgerald 07-22-2012 05:02 PM

Quote:

Originally Posted by Lynne (Post 2350482)
Where are you putting that condition - what hook location? did you look up the hook and verify you are using the correct variable names?

Hi Lynne,

it's in a plugin, the hook is postbit_display_complete, I have no idea how I look up the hook to verify if I am using the correct names.

I have made it ignore a single forum with this:

PHP Code:

if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND $forum[forumid] != '34') { 

but now I need it to ignore 2 forums

Lynne 07-22-2012 05:13 PM

You lookup the hook by just doing a search in your vbulletin file directory for "postbit_display_complete" and then the file should come up. (I use BBEdit, my text editor, to do this.)

Anyway, that variable isn't available there. Use $this->thread['forumid']

Kirk Fitzgerald 07-22-2012 05:31 PM

Quote:

Originally Posted by Lynne (Post 2350495)
You lookup the hook by just doing a search in your vbulletin file directory for "postbit_display_complete" and then the file should come up. (I use BBEdit, my text editor, to do this.)

Anyway, that variable isn't available there. Use $this->thread['forumid']

Hi Lynne,

thanks for the information, I tried this but it isn't working, I am guessing I haven't used it correctly, would you correct it for me please:
PHP Code:

if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (in_array($forumid != $this->thread['forumid'], array(3454)))) { 


Lynne 07-23-2012 02:35 AM

Use $this->thread['forumid'] instead of $forumid

Kirk Fitzgerald 07-23-2012 08:28 PM

Quote:

Originally Posted by Lynne (Post 2350609)
Use $this->thread['forumid'] instead of $forumid

Hiya Lynne,

thank you so much for your help with this, I apologise for taking so long in getting back to this, so many tasks to perform so little time. :)

I must be totally retarded or something because this is now turning off the image resizer in all forums not just 34 and 54, would please be so kind as to look at the code I have used and tell me where I have gone wrong please.

PHP Code:

if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (in_array($this->thread['forumid'] != forum['forumid'], array(3454)))) { 

I need the image resizer to work in all forums except for 34 and 54!

Sorry to be proving a burden here and thank you very kindly for your help.

Lynne 07-24-2012 02:27 AM

Try:

PHP Code:

if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (in_array($this->thread['forumid'], array(3454))) { 

(Check the (( and )) cuz I'm not sure I added them up correctly.)

php in_array function - http://php.net/manual/en/function.in-array.php

Kirk Fitzgerald 07-24-2012 05:25 AM

Success, we just needed the not (!) in array:
PHP Code:

if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (!in_array($this->thread['forumid'], array(3454))) { 

Thank you very much for your help Lynne, much appreciated. :)


All times are GMT. The time now is 11:42 AM.

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.01033 seconds
  • Memory Usage 1,744KB
  • 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
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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