Show or Hide Content for Logged in Users

In this guide, I will show you show or hide data to logged-in users.

Show content for not logged in users

With this shortcode, only logged out users will see it.

// Show custom message for NOT Logged in Users 
[firebase_show_not_login class='your-class-name']YOUR HTML CODE[/firebase_show_not_login]

Show content for logged in users

With this shortcode, only logged in users will see it.

// Show custom message for Logged in Users 
[firebase_show class='your-class-name']This message is only for logged in users![/firebase_show]

Show content for users with custom claims

In Firebase, we have custom claims to define a user’s role. So we can decide to hide a show a piece of content such as a post, a page or just a part of the content to a logged-in user with a claim.

// only user with admin claim will see the content 
// otherwise they will see a Custom message 
[firebase_show_with_claims class='your-class-name' claims='admin' message='Custom message' ] HTML Data With Tags [/firebase_show_with_claims]

The shortcode above will only show content to a logged-in user with admin as the custom claim. If they don’t have the admin claim, they will see the Custom message. Otherwise, they will see the main content.

You can use this demo with custom claims as admin in order to view the content.

Username: claims@dalenguyen.me
Password: demo123

This content is only visible for ADMIN claim!