MyBB Hacks

Full Version: Very new at PHP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6

PHP Code:
<if $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
</if>

But i want a closed thread to have '[Closed]' on it and closed+sticky threads to have just 'Sticky:'

If I use than then a closed thread that is also sticky will say 'Sticky: [Closed]' instead of just 'Sticky:'

mmm, thinking about it maybe it doesn't matter that much...
maybe this would work:

Code:
<if $thread['sticky'] then>
<img src="my_awesome_sticky_icon.gif" alt="Too bad you can't see this awesome sticky icon!" />
<elseif  $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
<else>{$icon}
</if>

^ Thanks, I just change it to this:

PHP Code:
<if $thread['sticky'] then>
{$prefix}
<elseif  $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
<else>
{$prefix}
</if>


{$icon} was for the icon and no the prefix n.nU

I think it worked. Thanks leefish Smile

Oh, I misread that in the thread, but I'm glad you found the logic useful Smile
I'll just respond here so I don't need to make a new thread for such a dumb question: how can I display an element only if a user is on a specific page (e.g. index.php)?

Basically I want to include elements in the header only on specific pages such as index.php. Would also like to hide some elements if the user is logged in.

Code:
<if $mybb->usergroup['gid'] == 1 then>
guest stuff
<else>
member stuff
</if>



Code:
<if THIS_SCRIPT == "index.php" then>
Stuff for index
<else>
other stuff
</if>


Should work for template conditionals

Thank you!
Something I have been trying to get to work for a while and I thought I would share it:

I use this on profiles where I have some tabs, the content of the tab is determined by a plugin, and is only populated if certain criteria is met, but the tab is a jQuery tab on the page. Rather than there being a tab visible with no content I remove the tab with the below code.

Code:
<if !in_array($memprofile['usergroup'],array(1,2,5,7,10)) then>
Stuff visible on profile only if profile owner's usergroup is NOT in the above array
</if>

You may wish to use a 'whitelist' type exclusion rather than a 'blacklist'.  The former is more restrictive, but isn't subject to you forgetting to add more items to the blacklist when you create a new group.
Pages: 1 2 3 4 5 6
Reference URL's