Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Two mandatory conditions? It does not work ..
Steeep Offline
Junior Member
**
Posts: 10
Joined: Aug 2012
Post: #1
Question Two mandatory conditions? It does not work ..
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:
1
2
3
4
5
6
	<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.

(This post was last modified: 08-21-2012 07:47 AM by Steeep.)
08-21-2012 07:45 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: Two mandatory conditions? It does not work ..
You can try to use OR

08-21-2012 08:02 AM
Find all posts by this user Quote this message in a reply
Steeep Offline
Junior Member
**
Posts: 10
Joined: Aug 2012
Post: #3
RE: Two mandatory conditions? It does not work ..
It works, but I see NOT only shown if one condition is met when they should be both.
08-21-2012 08:20 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #4
RE: Two mandatory conditions? It does not work ..
What about:

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


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
08-21-2012 08:51 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Steeep Offline
Junior Member
**
Posts: 10
Joined: Aug 2012
Post: #5
RE: Two mandatory conditions? It does not work ..
OR putting only works so far and think it's okay that I give & future "problems".
08-21-2012 09:33 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Two mandatory conditions? It does not work ..
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)

My Blog
(This post was last modified: 08-21-2012 10:05 AM by ZiNgA BuRgA.)
08-21-2012 10:05 AM
Find all posts by this user Quote this message in a reply
Steeep Offline
Junior Member
**
Posts: 10
Joined: Aug 2012
Post: #7
RE: Two mandatory conditions? It does not work ..
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.
08-21-2012 10:50 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: