Sometimes you need the current subscriber on your website. Mailster has some built-in methods to get this information.

Whenever a user clicks on a link in your campaign Mailster sets a cookie with the subscriber’s hash. This cookie will expire in 60 minutes. If the user clicks again on a link the cookie will again start expiring in 60 minutes.

Increase cookie expiration time.

Set the time to three hours:

add_filter( 'mailster_cookie_time', function(){
    return 3 * HOUR_IN_SECONDS;
} );

Get the current subscriber

This will return an object from the current subscriber or false if not available:

$subscriber = mailster_get_current_user();

Get the ID of the current subscriber

This will return the ID of the current subscriber or false if not available.

$subscriber_id = mailster_get_current_user_id();
Tagged: