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
Hi, i want to show sometext to usergroup1 and anothertext to usergroup5 and anothertextagain to usergroupelse

This is what i used but obviusly didn't worked:

Code:
<if $mybb->usergroup['gid'] == 1 then>
guest
<elsif $mybb->usergroup['gid'] == 5 then>
awaiting activation
<else>
any other member
nothing
</if>


I'm very new at PHP so basically i do not know what to do Tongue thanks!

Your code essentially does exactly what you asked for.

I think you're going to need to clarify/rephrase what you want, because I don't see a problem with your code...
>->

Try it after you answered me and it worked out, the first time I try it it didn't worked, don't know why (it messed up my forum template).

Just for make this thread useful, are there any other better ways to archive this?

Thank anyway Smile

Pd: guest and awaiting activation is showing to guest at the same time, it is supposed to show guest just to guests (gid1) and awaiting activation just to gid5 and any other member
nothing
to any other gid that is not gid1 or nor gid5 Frown
(05-13-2011 10:58 PM)Sama34 Wrote: [ -> ]Pd: guest and awaiting activation is showing to guest at the same time, it is supposed to show guest just to guests (gid1) and awaiting activation just to gid5 and any other member
nothing
to any other gid that is not gid1 or nor gid5 Frown

Look at the line #3:
(05-13-2011 09:34 PM)Sama34 Wrote: [ -> ]

Code:
<elsif


There is a typo there. It should be:

Code:
<elseif


I think it should fixes the issue.

Yes, it solved it (to what I know). Thank you RateU.
Gah, missed that.  Thanks for picking it up RateU.
Jajaja Sama xD
You says this:
<if $mybb->usergroup['gid'] == 1 then>
guest
<elsif $mybb->usergroup['gid'] == 5 then>
awaiting activation
<else>
any other member
nothing
</if>

And is:
<if $mybb->usergroup['gid'] == 1 then>
guest
<elsif $mybb->usergroup['gid'] == 5 then>
awaiting activation
<else>
any other member
nothing
</if>

elseif no elsif xD
Gypaete, you get banned from mybb-es, why? (pm me if you want to answer)

On topic: To conclude, I used elsif because that is what I read from other sites (maybe this, or this one, I don't remember).
By Edson Ordaz ._.

Proof this:
<?php if($mybb->usergroup['gid'] == 1): ?>
Hello guest
<?php elseif($mybb->usergroup['gid'] == 5): ?>
Hello, <? ".$mybb->user['username']." ?>, awaiting acount.
<?php else: ?>
Bla bla bla..
<?php endif; ?>

Spanish: Sama, tĂș pusiste en tu code elsif y es elseif
English: Sama, you put in your code elsif and is elseif
PHP is not Perl.
Pages: 1 2 3 4 5 6
Reference URL's