Elseif Statements--Take 2!


#1

Thanks for your help so far! I’ve tried using elseif statements but it’s not working. I think because my 2 employer groups are exactly the same except for the membership options. So, when I use an elseif statement like the two examples attached, the actions are occurring twice. For example, on my top menu, I’ve incorporated an elseif statement and the actions relevant to employers now show up twice, i.e, search resumes, post jobs.

Can you please have a look at the code and let me know what I might be doing wrong.

Thanks much!

Carrie
[php]{if $GLOBALS.current_user.group.id == “Employer”}
[[Notify on My Jobs Approve Or Reject]]
{elseif $GLOBALS.current_user.group.id == “Employer1”}
[[Notify on My Jobs Approve Or Reject]]
{else}
[[Notify on My Resumes Approve Or Reject]]
{/if}[/php]

[php]{if $GLOBALS.current_user.group.id == “Employer”}
[[Notify on My Jobs Activation]]
{elseif $GLOBALS.current_user.group.id == “Employer1”}
[[Notify on My Jobs Activation]]
{else}
[[Notify on My Resumes Activation]]
{/if}[php]

[php]{if $GLOBALS.current_user.group.id != “Employer”}
[[Find Jobs]]   
[[Post Resumes]]   
{/if}
{if $GLOBALS.current_user.group.id != “Employer1”}
[[Find Jobs]]   
[[Post Resumes]]   
{/if}
{if $GLOBALS.current_user.group.id != “JobSeeker”}
[[Search Resumes]]   

 [[Post Jobs]]   
{/if}[php]


#2

Well, this does not look like standard PHP code, but, I will give it a try…

It looks like you listed three paragraphs of code. One inside a PHP tag and two outside tags…

The first one is an IF-ELSE that checks for two options “employer” and “employer2”, then handles commands based on each. Lastly, if neither of these hit, it does the 3rd code. This is formatted as it should.

The next batch of code is the same as the first one.

The last batch of code is an series of three IF’s that each do one thing. They each check if the value is NOT EQUAL TO ( != ) “employer”, “employer2” and “JobSeeker”. These are separate IF’s that do some code if the condition happens. SO, if the input to the condition was “Ernie”, ALL THREE conditions would equal TRUE and all three would do their code. I am assuming you only want one of these three to execute. There fore you need to do an IF-ELSEIF-ELSEIF testing the 3 conditions. You can leave the 3 condition tests as is, but, not if they each test for NOT-EQUAL. Hope that makes sense…