Cookie Tasting Wordpress Plugin - Rating, Reviews, Demo & Download

Cookie Tasting Preview Wordpress Plugin - Rating, Reviews, Demo & Download
No ratings yet
Free
Follow for free plugins, new theme releases and theme news

Plugin Description

This plugin sets user cookie when user is logged in.
You can use cookie as data store,
so you can use it as UI resource.

Visibility

This plugin adds class to html element.

  • ct-logged-in The current user is logged in.
  • ct-not-logged-in The current user is anonymous.

You can control elements visibility with CSS.

.some-element{
  display: none;
}
.ct-logged-in .some-element{
  display: block;
}

From JavaScript

You can use Global Object CookieTasting for utility.

  • CookieTasting.userName() Returns user name. If not logged in, returns ‘Geust’.
  • CookieTasting.lastUpdated() Returns timestamp of last log in check. If this equals 0, it means that user is anonymous.

Besides that, this plugin checks periodically log-in status.
You can handle it with jQuery.

jQuery( document ).on( 'cookie.tasting', function( event, response ) {
    if ( response.login ) {
        // User is logged in.
        // If you use React...
        setAttributes({ name: CookieTasting.userName() })
    } else {
        // User is not logged in.
    }
} );

If you use react or something, updated the status with setState().

Screenshots

No screenshots provided


Reviews & Comments