PDA

View Full Version : [RESOLVED] php forumid array


Kirk Fitzgerald
07-22-2012, 03:00 PM
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:
if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (in_array($forumid != forum['forumid'], array(34, 54)))) {

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
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:

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
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:
if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (in_array($forumid != $this->thread['forumid'], array(34, 54)))) {

Lynne
07-23-2012, 02:35 AM
Use $this->thread['forumid'] instead of $forumid

Kirk Fitzgerald
07-23-2012, 08:28 PM
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.

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

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:

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



(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:
if ($vbulletin->options['sevenskins_imageresizer_post_enabled'] AND (!in_array($this->thread['forumid'], array(34, 54))) {

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