MyBB Community Forums

Full Version: If empty...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When in MyBB Settings, setting "reminder_admin_text" is empty I want this:
if ($mybb->usergroup['cancp'])
 if($mybb->settings['reminder_enabled'] == 1)
if($mybb->settings['reminder_quantity'] == 1)
if(!empty($mybb->settings['reminder_admin_text'])) {
$reminder = '<table border="0" cellspacing="0" cellpadding="0" class="tborder">
<tr>
<td style="word-break: break-all;" class="thead"><p align="center">'.$mybb->settings['reminder_name'].'</p></td>
</tr>
<tr>
<td style="word-break: break-all; padding: 10px;" class="trow1"> <p align="center">EMPTY</p></td>
</table><br /><br />';
}
but word "EMPTY" is ever than, when this setting is filled.
It is really ugly not using any braces for an IF statement in PHP. I think that is contriifbuting to your problem. Second, you can drop the !empty and just have that part be
if($mybb->settings['reminder_admin_text']) {
// Rest of your code
}
(2016-11-01, 01:07 PM)dragonexpert Wrote: [ -> ]It is really ugly not using any braces for an IF statement in PHP

This. Could also be combined into one condition:

if($mybb->usergroup['cancp'] && $mybb->settings['reminder_enabled'] == 1 && $mybb->settings['reminder_quantity'] == 1 && $mybb->settings['reminder_admin_text'])
It's not work. I tried with:
		if ($mybb->usergroup['cancp'])
		if($mybb->settings['reminder_enabled'] == 1)
			if($mybb->settings['reminder_quantity'] == 3)
				if($mybb->settings['reminder_admin_text'])
		{
			$reminder = '
				<table border="0" cellspacing="0" cellpadding="0" class="tborder">
					<tr>
						<td style="word-break: break-all;" class="thead"><p align="center">'.$mybb->settings['reminder_name'].'</p></td>
					</tr>
					<tr>
	<td style="word-break: break-all; padding: 10px;" class="trow1"> <p align="center">'.$mybb->settings['reminder_admin_text'].'</p></td>
				</table><br /><br />
			<table border="0" cellspacing="0" cellpadding="0" class="tborder">
					<tr>
						<td style="word-break: break-all;" class="thead"><p align="center">'.$mybb->settings['reminder_name'].'</p></td>
					</tr>
					<tr>
	<td style="word-break: break-all; padding: 10px; border-bottom: 2px solid #E3E3E3" class="trow1"> <p align="center">'.$mybb->settings['reminder_text'].'</p></td>
	<tr>
	<td style="word-break: break-all; padding: 10px; border-bottom: 2px solid #E3E3E3" class="trow1"> <p align="center">'.$mybb->settings['reminder_text2'].'</p></td>
	</tr>
		<td style="word-break: break-all; padding: 10px;" class="trow1"> <p align="center">'.$mybb->settings['reminder_text3'].'</p></td>
				</table><br /><br />';
		}
EDIT: I'm sorry, I forgot about change quantity ;)

It's not working. Why?
 if($mybb->settings['reminder_enabled'] == 1)
            if($mybb->settings['reminder_quantity'] == 1)
While these circumstances will be agree this table still will be show.
I don't know, as bypass this without remove this settings.