MyBB Hacks

Full Version: How to use <if gids in .php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to use <if gid> statements in .php files and i know its not possible and we can only use if(cond) { }

This is the code in .php file

Code:
$ontoday=<<<HERE
<td class="trow1"><a href="/forum/online.php?action=today" target="_blank"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/></a>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;


I want to hide <a href="/forum/online.php?action=today" target="_blank"> for certain gids, and i tried to use <if gid> as we see other tags are also the same mostly like <td class="">
But its showing error. Any help pls?

I'm a bit lost - what template are you referring to? You want to hide the links to Whos online? Please try and be a bit clearer so we can try and help you.
As you said yourself, you need to use an if(...) clause.

PHP Code:
if(whatever) {
  $ontoday="blah";
} else {
  $ontoday="bleh";
}

OMG, you are the saviour zinga. Thanks Smile

This made the work.

Code:
if(in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6))) 
        {
                $ontoday=<<<HERE
                <td class="trow1"><a href="/forum/online.php?action=today" target="_blank"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/></a>
<span class="smalltext">{$who_online}</span><br />$onToday</td></tr>
HERE;
        } 
        else 
        {
                $ontoday=<<<HERE
                <td class="trow1"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/>
<span class="smalltext">{$who_online}</span><br />$onToday</td></tr>
HERE;
        }


Topic Solved

Reference URL's