Imitate logged-in patron for local testing

Hi! I try to modify our theme for display content of posts only for patrons included Posts name and another. I try to do it on local dev server. Can I set any variables like a patron logged-in, it needed for design tests?

Thank you.

Since im onboard a train i cant point you out to the exact function, but there should be various examples in the forum where the function which the plugin uses for checking if patrons are logged in is used. Better would be to check for patronage level, since it would include both. This function can constantly be used since it caches its result and doesnt repeatedly contact the API. Ie, you dont need to set a var, just call the function anytime you need that status.

1 Like

Ok, thank you, i will find.

1 Like

Patreon_Wordpress::isPatron()

returns you the

Patreon_Wordpress::$current_user_is_patron

static var which holds user’s patron status.

Patreon_Wordpress::getUserPatronage();

would return you the

Patreon_Wordpress::$current_user_pledge_amount

var, which holds the current user’s pledge amount. The latter implies the former so its better to use the latter one.

1 Like