• Resolved iantiu

    (@iantiu)


    I need a hashbar on my website that shows up when user is not logged in. The bar will say something like Login or Register.

    Once the user is logged in, it will no longer show up.

    I’ve found the snippet below on a separate thread. However, it does the exact opposite for me. When I’m logged in, it shows up, and disappears when I’m logged out. What is causing this? Thanks ??

    add_filter('hashbar_should_output', 'hashbar_wpnb_should_output', 10, 2);
    function hashbar_wpnb_should_output($status, $post_id){
        if ( !is_user_logged_in() ) {
            $status = false;
        }
        return $status;
    }
    • This topic was modified 2 years, 7 months ago by iantiu.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor HT Plugins

    (@htplugins)

    Hello @iantiu,

    Thank you so much for reaching out to us ??

    The above code is used to show up the notification only for logged-in users.

    If you want to hide the notification for logged-in users then you need to change a little bit in the above code. The code is given below.

    add_filter('hashbar_should_output', 'hashbar_wpnb_should_output', 10, 2);
    function hashbar_wpnb_should_output($status, $post_id){
        if ( is_user_logged_in() ) {
            $status = false;
        }
        return $status;
    }

    Best regards,
    Support Team

    Thread Starter iantiu

    (@iantiu)

    Awesome! It works! The “!” made the difference. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Log In Bar for Logged Out Users’ is closed to new replies.