MyBB Hacks

Full Version: Two mandatory conditions? It does not work ..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good'm new to the forum, I have been a problem with the Plugin Template Conditionals, and I have a conditional sentence with two but the problem is that not should be respected as the code is as follows.

PHP Code:
	<if THIS_SCRIPT != "member.php" AND $GLOBALS['mybb']->input['action'] != "register" then>
	<div class="tbar_sep"></div>
	<div class="tbar_item tbar_iregister">
		<a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a>
	</div>
	</if>


It is assumed that the registration link should not show when in the page [b]forums/member.php?action=register[/ b], but if I go to the page [b] forums/member.php?action=login[/ b] and not shown here assume that if I should be displayed.

It is assumed that the judgment is to put the TWO conditionals are met, but that does not happen .. Any solution?

Thank you in advance.

PS: Sorry for the bad English, but Spanish is my thing.

You can try to use OR
It works, but I see NOT only shown if one condition is met when they should be both.
What about:

PHP Code:
<if !(THIS_SCRIPT == 'member.php' && $mybb->input['action'] == 'register') then>

OR putting only works so far and think it's okay that I give & future "problems".
You need to think through your logic.

For THIS_SCRIPT != "member.php" AND $GLOBALS['mybb']->input['action'] != "register"
- member.php?action=register: THIS_SCRIPT is 'member.php' so condition is false
- member.php?action=login: THIS_SCRIPT is 'member.php' so condition is still false

For THIS_SCRIPT != "member.php" OR $GLOBALS['mybb']->input['action'] != "register"
- member.php?action=register: THIS_SCRIPT is 'member.php' so first condition is false; action is 'register' so second condition is false, meaning whole condition is false
- member.php?action=login: THIS_SCRIPT is 'member.php' so first condition is still false, but action is NOT 'register', so second condition is true, making the entire condition true

Note that
!(THIS_SCRIPT == 'member.php' AND $mybb->input['action'] == 'register')
is identical to
THIS_SCRIPT != "member.php" OR $GLOBALS['mybb']->input['action'] != "register"
(De Morgan's law)
Actually I could not understand all the explanation, or the translator could D:

But when testing the code that you left me I came to understand the logic of occupying it, just as he had done before but I turned.

Thank you.
Reference URL's