• Resolved evapy

    (@evapy)


    Hey guys, I’m just trying to show “test” when the user is connected and the button when he’s not, but no matter if I’m connected or not, mobile or desktop, it always shows both.

    I’m using the HTML widget in elementor pro, here’s my code :

    HTML/PHP
    <?php add_action(‘init’, ‘ajax_auth_init’);
    function ajax_auth_init()
    {
    if(is_user_logged_in()) return; ?>
    <div class=”.logged in .dejaconnecte”>Test </div>
    <div class=”.logged in .rejoindreevapy”>Join</div><?php ; ?>
    <?php $(“.logged in .rejoindreevapy”).hide(); ?>
    <?php
    }else {?>
    <div class=”dejaconnecte”></div>
    <div class=”rejoindreevapy”></div>
    <?php $(“dejaconnecte”).hide(); ?> <?php ; ?>
    <?php } ?>

    CSS
    <–logged out–>
    .rejoindreevapy {
    margin-left: auto;
    margin-right: auto;
    width: 49%;
    }

    .dejaconnecte {
    display: none;
    }

    <–logged in–>
    .logged-in .rejoindreevapy {
    display: none;
    }

    .logged-in .dejaconnecte {
    margin-left: auto;
    margin-right: auto;
    display: inline;
    }

Viewing 1 replies (of 1 total)
  • The HTML widget does not accept PHP code

    I see you are using Elementor Pro. I recommend you take advantage of our Premium support by contacting support from your my.elementor.com

    It has a faster response time and we can do a better follow up with your issue this way

Viewing 1 replies (of 1 total)

The topic ‘is_user_logged_in() not working ?’ is closed to new replies.