Matrix Version: 5.5.2
When a user is logged in but doesn’t have read access, the Login Design isn’t treating them as Logged In in terms of displaying my “Logout” portion of the Login Design Area, to say "You are currently logged in as: … " - It instead displays the Username and Password Fields.
However, when I use a Show_If area of Logged In condition, it DOES evaluate as True / Logged in, and then show the “THEN” portion (rather than “ELSE”). However, when the THEN portion is set to print the (previously defined in the Design File but print=“no”) Login Design Area, it will opt to print the LOGIN not the LOGOUT portion of that Design Area…
I saw another post with a similar issue from last year, but it was referring to a bug in an earlier version of Matrix, and pointed to Road Map - which I do not have access to view. I assume that the bug would have been patched in my current version of 5.5.2.
Here are my Design Area codes:
If the User is logged in, then the show_if area prints this Design Area:
<MySource_AREA id_name="logged_in" design_area="login_form" print="no"> <li class="logged-in-block"> <MySource_PRINT var="system_messages" /> <MySource_LOGIN_SECTION> Not currently logged in. This should not be printing, but does. </MySource_LOGIN_SECTION> <MySource_LOGOUT_SECTION> <MySource_PRINT var="form_open" /> Currently logged in as: <MySource_PRINT id_name="__global__" var="current_user" default="[Not Logged In]" attr="name" /> <MySource_PRINT var="submit_button" value="Logout" class="sq-backend-data btn btn--primary col-md-3 align-baseline" /> <MySource_PRINT var="form_close" /> </MySource_LOGOUT_SECTION> </li> </MySource_AREA>
Is the user logged in? If so, print the logged_in design area (above). Else, print a Login pop-out lightbox so they can login or create an account.
<MySource_AREA id_name="public_user" design_area="show_if"> <MySource_SET name="condition" value="logged_in" /> <MySource_THEN> <MySource_PRINT id_name="logged_in"/> </MySource_THEN> <MySource_ELSE> <li> <div class="modal-instance"> <a href="#" class="modal-trigger">Login</a> <div class="modal-container"> <div class="modal-content section-modal"> <section class="unpad "> <div class="container"> <div class="row justify-content-center"> <div class="col-md-6"> <div class="boxed boxed--lg bg--white text-center feature"> <div class="modal-close modal-close-cross"></div> <h3>Login to Your Account</h3> <div class="feature__body"> <MySource_PRINT id_name="login"/> <span class="type--fine-print block"> Don't have an account yet? <a href="./?a=50250">Create account</a> </span> <span class="type--fine-print block"> Forgot your username or password? <a href="./?a=42388">Recover account</a> </span> </div> </div> </div> </div><!--end of row--> </div><!--end of container--> </section> </div> </div> </div> </li> </MySource_ELSE> </MySource_AREA>
I use the exact same code in my normal Design File too, and it works without fault.
And if the user truely is not logged in, then it works fine because the Show_IF ELSE portion displays.
(Initially I did not have the LOGIN section of the Login Design Area in the code, but placed it in to help identify what was happening with the Login Design Area not printing the LOGOUT portion.)
Anyone else come across this? Any solutions?