Skip to content

Commit

Permalink
cache imagify user response even in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuLamiot committed Nov 8, 2024
1 parent a3e1630 commit c71460c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ public function __construct() {
if ( ! $user ) {
$user = get_imagify_user();

set_transient( 'imagify_user_cache', $user, 5 * MINUTE_IN_SECONDS );

if ( is_wp_error( $user ) ) {
$this->error = $user;
return;
}

set_transient( 'imagify_user_cache', $user, 5 * MINUTE_IN_SECONDS );
}

$this->id = $user->id;

Check warning on line 141 in classes/User/User.php

View workflow job for this annotation

GitHub Actions / WP 5.3 with PHP 7.3 on ubuntu-latest.

Undefined property: WP_Error::$id

Check warning on line 141 in classes/User/User.php

View workflow job for this annotation

GitHub Actions / WP latest with PHP 8.0 on ubuntu-latest.

Undefined property: WP_Error::$id

Check warning on line 141 in classes/User/User.php

View workflow job for this annotation

GitHub Actions / WP latest with PHP 7.4 on ubuntu-latest.

Undefined property: WP_Error::$id
Expand Down

0 comments on commit c71460c

Please sign in to comment.