Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Very new at PHP
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #1
Very new at PHP
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:
1
2
3
4
5
6
7
8
<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!


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 05-13-2011 09:34 PM by Sama34.)
05-13-2011 09:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Very new at PHP
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...

My Blog
05-13-2011 10:08 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #3
RE: Very new at PHP
>->

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

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 05-13-2011 11:08 PM by Sama34.)
05-13-2011 10:58 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Very new at PHP
(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:
3
<elsif


There is a typo there. It should be:

Code:
3
<elseif


I think it should fixes the issue.


05-14-2011 03:16 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #5
RE: Very new at PHP
Yes, it solved it (to what I know). Thank you RateU.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-14-2011 05:24 AM
Visit this user's website 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: Very new at PHP
Gah, missed that.  Thanks for picking it up RateU.

My Blog
05-14-2011 09:20 AM
Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #7
RE: Very new at PHP
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

[Image: selenab.png]
05-16-2011 12:41 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #8
RE: Very new at PHP
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).

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-16-2011 06:30 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #9
RE: Very new at PHP
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

[Image: selenab.png]
05-17-2011 01:57 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #10
RE: Very new at PHP
PHP is not Perl.

My Blog
05-17-2011 07:49 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: