ContextInstitute / bfcom

http://bfn.context.org
GNU General Public License v3.0
4 stars 1 forks source link

If the user is logged out, present login link instead of user menu #56

Closed iangilman closed 6 years ago

iangilman commented 6 years ago

BTW, it appears that this isn't an issue on the production site, since it redirects the user to an entirely different login page. We ran into some trouble related to this on the local site, though, so it seems worth fixing.

iangilman commented 6 years ago

For reference, here's how you mix PHP if statements with HTML:

<?php if($condition) : ?>
    <a href="http://yahoo.com">This will only display if $condition is true</a>
<?php elseif($anotherCondition) : ?>
    more html
<?php else : ?>
    even more html
<?php endif; ?>

Though in this case you are already inside a large PHP block, so the beginning and ending PHP tags are already taking care of you. Also you don't need the elseif in this case. So, your new code would end up looking more like:

if($condition) : ?>
    <a href="http://yahoo.com">This will only display if $condition is true</a>
<?php else : ?>
    even more html
<?php endif; 
rgilman commented 6 years ago

The dev site bfn.context.org is using a plugin called Restricted Site Access.

Doing our own re-direct sounds like a good step. I see this as part of the bigger picture in #47 since we will eventually want to send:

I support doing whatever you feel is a useful next step in this direction.

iangilman commented 6 years ago

Cool. Good to have the context. I think for starters just being able to know whether you're logged in (and present a different UI then) is a good start.

rgilman commented 6 years ago

Works for me.