You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
does not make sense. You accept a user argument but only use one static cache variable. Any call to this function will first check that cache which gets filled by the first valid user. You then return this cached value, regardless of the actual user argument.
This is my proposed solution if you want to keep using the simple cache:
public static function getUserPatronage( $user = false ) {
- if ( self::$current_user_pledge_amount != -1 ) {- return self::$current_user_pledge_amount;- }-
// If user is not given, try to get the current user attribute ID will be 0 if there is no logged in user
if ( $user == false ) {
+ if ( self::$current_user_pledge_amount != -1 ) {+ return self::$current_user_pledge_amount;+ }
$user = wp_get_current_user();
}
It only uses the cache if you actually request the current user. Ofcourse this isnt perfect, and also not the only place that this would have to be fixed, but i hope you get the general idea.
The text was updated successfully, but these errors were encountered:
Also i should add that this is not the only function that has this issue. getUserPatronageDuration, getUserPatronageLevel and some others are affected.
This
patreon-wordpress/classes/patreon_wordpress.php
Lines 564 to 568 in d7f28ff
does not make sense. You accept a user argument but only use one static cache variable. Any call to this function will first check that cache which gets filled by the first valid user. You then return this cached value, regardless of the actual user argument.
This is my proposed solution if you want to keep using the simple cache:
It only uses the cache if you actually request the current user. Ofcourse this isnt perfect, and also not the only place that this would have to be fixed, but i hope you get the general idea.
The text was updated successfully, but these errors were encountered: