vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Trying to use if conditional but can't get it to work (https://vborg.vbsupport.ru/showthread.php?t=291635)

RedTurtle 11-24-2012 05:51 PM

Trying to use if conditional but can't get it to work
 
I'm trying to use the code below to make the following happen:

If $show['spelling_checker'] OR $show['infraction_checker'] are true AND $vbulletin->GPC['accept_rules'] is not true, then show the error code.

Also, if $show['intro_checker'] is true and $vbulletin->GPC['intro_rules'] is not true, also show the error code.

I'm trying to put them together in one combined statement, but not sure what I'm doing wrong.

PHP Code:

 if (($show['spelling_checker'] || $show['infraction_checker']) && !$vbulletin->GPC['accept_rules']) || if($show['intro_checker'] && !$vbulletin->GPC['intro_rules']) 
   {
       
$errors[] = "<span style='color: #ba0000; background-color: #FDFD65;'>Please accept the highlighted rules shown below before submitting your post.</span>";
   } 


Lynne 11-24-2012 05:58 PM

You don't have () around the full condition and you have an extra if:

PHP Code:

 if ((($show['spelling_checker'] || $show['infraction_checker']) && !$vbulletin->GPC['accept_rules']) || ($show['intro_checker'] && !$vbulletin->GPC['intro_rules'])) 


RedTurtle 11-24-2012 06:10 PM

Thank you Lynne. :)


All times are GMT. The time now is 02:17 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.00944 seconds
  • Memory Usage 1,714KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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