Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2012, 03:00 PM
Kirk Fitzgerald's Avatar
Kirk Fitzgerald Kirk Fitzgerald is offline
 
Join Date: Apr 2012
Location: Oxford, UK
Posts: 139
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [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.
Reply With Quote
  #2  
Old 07-22-2012, 04:38 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where are you putting that condition - what hook location? did you look up the hook and verify you are using the correct variable names?
Reply With Quote
  #3  
Old 07-22-2012, 05:02 PM
Kirk Fitzgerald's Avatar
Kirk Fitzgerald Kirk Fitzgerald is offline
 
Join Date: Apr 2012
Location: Oxford, UK
Posts: 139
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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
Reply With Quote
  #4  
Old 07-22-2012, 05:13 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']
Reply With Quote
  #5  
Old 07-22-2012, 05:31 PM
Kirk Fitzgerald's Avatar
Kirk Fitzgerald Kirk Fitzgerald is offline
 
Join Date: Apr 2012
Location: Oxford, UK
Posts: 139
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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)))) { 
Reply With Quote
  #6  
Old 07-23-2012, 02:35 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use $this->thread['forumid'] instead of $forumid
Reply With Quote
  #7  
Old 07-23-2012, 08:28 PM
Kirk Fitzgerald's Avatar
Kirk Fitzgerald Kirk Fitzgerald is offline
 
Join Date: Apr 2012
Location: Oxford, UK
Posts: 139
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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.
Reply With Quote
  #8  
Old 07-24-2012, 02:27 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 07-24-2012, 05:25 AM
Kirk Fitzgerald's Avatar
Kirk Fitzgerald Kirk Fitzgerald is offline
 
Join Date: Apr 2012
Location: Oxford, UK
Posts: 139
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:05 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.07518 seconds
  • Memory Usage 2,257KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete